SivertGullbergHansen / arr-cleaner

Cleans up stalled or failed downloads from *Arr applications.
MIT License
3 stars 0 forks source link

Error Making Request to Radarr #1

Closed ptarafdar1 closed 6 months ago

ptarafdar1 commented 6 months ago

Found your repo from the issue raised on MattDGTL's repo. I am running the script through Python directly. I set the Radarr and Sonarr url and API keys through environment variables. Sonarr works perfectly fine and is successfully cleaning, but every time the script gets to Radarr, I get this error with the response seeming to be empty (or None). Both Radarr and Sonarr are set up the same way on the local system on localhost:7878 and localhost:8989, but only Radarr has this issue.

2024-04-21 06:57:09,733 [INFO]: ✨ Finished cleaning Sonarr 2024-04-21 06:57:09,734 [INFO]: 👀 Checking Radarr Traceback (most recent call last): File "C:\Users\Da Server\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 971, in json return complexjson.loads(self.text, **kwargs) File "C:\Users\Da Server\AppData\Local\Programs\Python\Python39\lib\json__init__.py", line 346, in loads return _default_decoder.decode(s) File "C:\Users\Da Server\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\Da Server\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Da Server\Desktop\arr-cleaner-main\main.py", line 37, in make_api_request return response.json() # Parse JSON response File "C:\Users\Da Server\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Da Server\Desktop\arr-cleaner-main\main.py", line 100, in loop.run_until_complete(main()) File "C:\Users\Da Server\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 647, in run_until_complete return future.result() File "C:\Users\Da Server\Desktop\arr-cleaner-main\main.py", line 91, in main await remove_stalled_downloads(RADARR_API_URL, RADARR_API_KEY, 'Radarr') File "C:\Users\Da Server\Desktop\arr-cleaner-main\main.py", line 54, in remove_stalled_downloads queue = await make_api_request('get', queue_url, api_key, {'page': '1', 'pageSize': await count_records(api_url, api_key)}) File "C:\Users\Da Server\Desktop\arr-cleaner-main\main.py", line 74, in count_records queue = await make_api_request('get', queue_url, api_key) File "C:\Users\Da Server\Desktop\arr-cleaner-main\main.py", line 42, in make_api_request if e.response.status_code == 404: AttributeError: 'NoneType' object has no attribute 'status_code'

SivertGullbergHansen commented 6 months ago

Hmmmmmmmmm, I'll try to aid you the best I can 😄 (I'm not super proficient in Python but let's try to break it down)

It seems to me based on this part:

if e.response.status_code == 404:
AttributeError: 'NoneType' object has no attribute 'status_code'

that the e.response object is null? Is it possible you could share your .env without exposing any keys or sensitive data? To me it seems like the response is not going through so it is not responding anything... So perhaps the url is incorrect? 😋

My ENV looks like this: CleanShot 2024-04-22 at 11 35 14@2x

SivertGullbergHansen commented 6 months ago

Also, I would just mention that I do recommend using https://github.com/ManiMatter/decluttarr, as it includes more features than my fork 😄 If we are not able to solve this, I recommend you check it out

ptarafdar1 commented 6 months ago

So I checked the urls and they appear to be configured correctly. However, I did check out Decluttarr and that appears to be working for me at the moment, so I'm good if you want to close this issue 😄