Automatically creates qBittorrent-Tag if not present already provided qBittorrent exists.

Downloads with this tag will be skipped from being removed when caught being stuck donwloading metadata, or when stalled.
This commit is contained in:
Benjamin Harder
2023-10-02 09:14:52 +02:00
parent faa88ee718
commit 8bebd7d0b8
2 changed files with 16 additions and 6 deletions

View File

@@ -38,13 +38,12 @@ async def rest_delete(url, api_key, params=None):
return None
# POST
async def rest_post(url, api_key, data):
async def rest_post(url, data, headers):
if TEST_RUN: return
try:
headers = {'X-Api-Key': api_key} | {"content-type": "application/json"}
response = await asyncio.get_event_loop().run_in_executor(None, lambda: requests.post(url, data=data, headers=headers))
response.raise_for_status()
if response.status_code == 201:
if response.status_code in (200,201):
return None
return response.json()
except RequestException as e: