Reputation: 255
I've been working on integrating my application with Prowlarr and have hit a bit of a roadblock. I can successfully search through indexers and fetch results using the Prowlarr API, but I'm struggling with the next step: sending a torrent result to my download client (qBittorrent) through Prowlarr.
Here's what I've accomplished so far:
The problem arises when I try to use the /api/v1/downloadclient
endpoint to send the torrent to qBittorrent. I keep receiving a 405 Method Not Allowed
error, which suggests that I'm using the wrong HTTP method, but according to the Prowlarr API documentation, a POST request should be appropriate for this action.
I've confirmed that qBittorrent is set up correctly in Prowlarr and that I'm using the correct API key and download client ID. I'm using the Python requests
library to make the call, and my payload looks like this (simplified for brevity):
payload = {
"name": best_torrent["title"],
"downloadUrl": best_torrent.get("magnetUrl", best_torrent.get("downloadUrl")),
# ... additional fields as required by Prowlarr
}
I've also checked Prowlarr's logs, but they haven't shed much light on the issue. I'm starting to wonder if I've misunderstood how the download client is supposed to be specified or if there's an additional configuration step I've missed.
If anyone has experience with the Prowlarr API or has tackled similar issues, I'd greatly appreciate your insights. Specifically:
Are there any common pitfalls with the /api/v1/downloadclient endpoint that I should be aware of? Does the payload require any non-obvious fields that are not detailed in the documentation? Is there a different endpoint or method that I should be using to send results to qBittorrent?
import requests
from loguru import logger
def send_torrent_to_download_client(prowlarr_url, prowlarr_api_key, download_client_id, payload):
url = f"{prowlarr_url}/api/v1/downloadclient/{download_client_id}"
headers = {"X-Api-Key": prowlarr_api_key, "Content-Type": "application/json"}
response = requests.post(url, headers=headers, json=payload)
if response.ok:
logger.info("Torrent successfully sent to qBittorrent via Prowlarr.")
else:
logger.error(f"Failed to send torrent: HTTP {response.status_code} - {response.reason}")
# Example payload
payload = {
"name": "Example Torrent",
"downloadUrl": "magnet:?xt=urn:btih:examplehash",
"downloadClientId": 1 # Example ID
}
# Use your actual Prowlarr URL and replace the key with a placeholder
prowlarr_url = "http://your-prowlarr-address:9696"
prowlarr_api_key = "your_api_key"
# Example call
send_torrent_to_download_client(prowlarr_url, prowlarr_api_key, 1, payload)
Thank you in advance for any help you can provide!
Best,
littlejiver
Upvotes: 0
Views: 432