Trying to unmonitor a show after download via Python

Sonarr version (exact version):, release-657f4ee by hotio
Mono version (if Sonarr is not running on Windows):
OS: Docker Container on a Synology NAS setup using Trash Guides
Debug logs:
Description of issue: I am trying to mark an episode unmonitored on download (grab). I found someone that provided this python script that is supposed to do this (please don’t ask me why I want to do this, I just want to do it, thank you). I am attempting to learn Python but my knowledge is not very good right now. I used this script here:

I added all of my variables, sonarr_ip, sonarr_port and sonarr_api_token and tested it.

It did not work. Looking at the logs, the first error I see is an error on line 40 to “import requests”. Whatever this is, it isn’t working.

Next, I am getting unauthorized errors in trying to pass the URL that will unmonitor the show.

2023-03-25 11:39:44.5|Error||Traceback (most recent call last):
2023-03-25 11:39:44.5|Error|| File “/config/Scripts/”, line 40, in
2023-03-25 11:39:44.5|Error|| import requests
2023-03-25 11:39:44.5|Error||ModuleNotFoundError: No module named ‘requests’
2023-03-25 11:41:48.2|Info|DiskScanService|Scanning Shrinking
2023-03-25 11:41:48.2|Info|DiskScanService|Completed scanning disk for Shrinking
2023-03-25 11:41:48.2|Info|ExistingMetadataImporter|Found 0 existing metadata files
2023-03-25 11:41:48.2|Info|ExistingSubtitleImporter|Found 1 existing subtitle files
2023-03-25 11:41:48.4|Info|ExistingOtherExtraImporter|Found 0 existing other extra files
2023-03-25 11:41:48.4|Info|ExistingExtraFileService|Found 8 possible extra files, imported 8 files.
2023-03-25 11:44:04.9|Info|Auth|Auth-Unauthorized ip url ‘,411364,'monitored’: False’
2023-03-25 11:44:08.3|Info|Auth|Auth-Unauthorized ip url '
2023-03-25 11:44:10.0|Info|Auth|Auth-Unauthorized ip url '
2023-03-25 11:44:16.6|Info|Auth|Auth-Unauthorized ip url '
2023-03-25 11:44:20.9|Info|Auth|Auth-Unauthorized ip url '
2023-03-25 11:44:22.7|Info|Auth|Auth-Unauthorized ip url '
2023-03-25 11:44:30.3|Info|Auth|Auth-Unauthorized ip url '

Pasted here as well for better readability: 0bin - encrypted pastebin

I have a password on my Sonarr setup. Thinking it might be that, I disabled it and I still had issues.

Any suggestions on what may be happening here?

Funnily enough ive come across this exact issue with the same docker image and script. I think its because hotio sonarr doesnt have python installed so the script wont run. If i use the ‘sma’ sonarr image and then install ‘requests’ on the docker container the .py file passes (green tick) on sonarr

Hold on, hotio does have python (linuxserver does not). If you cli to the container, run /usr/bin/python3 -m ensurepip , then run /usr/bin/python3 -m pip install requests

Try the script now. Trouble being this wont persist across container recreations…

1 Like

Dumb question. How do I do that? I am familiar with ssh into a PC but I am not sure how to do it into a docker container. I tried ssh’ing into the NAS IP and Sonarr port as user docker. But that didn’t work.

If I go into DSM and then I to docker, and then try to terminal into the sonarr container I get a terminal screen but I cannot type into it.

Easiest way would be to install portainer and use the cli terminal for the container

In any case youll need to execute:

/usr/bin/python3.10 -m ensurepip
/usr/bin/python3.10 -m pip install requests

But as i say, this isn’t a proper solution as the changes made will not persist across container creations.

Thanks. I found a way to enter one command at a time into the Synology GUI…but it told me that the owner was different (I was logged into DSM as a different user than the container install). And it still isn’t working.

So when my container upgrades/rebuilds using Pullio, it will revert back correct? I am fine with that right now…I can keep working with it, but it would be good to know it will go back in case I screw it up too bad.

I do have portainer so i can try that too.

Yep it will revert. Use the commands in my.latest post and, I’ve just tried it. BUT the commands have to be entered on the running docker container, not Synology host itself (use portainer).

I need to connect as the “docker” user, correct? For permissions, right? I guess I can do that through Portainer.

Click the cli/console button for the container (in portainer) and run as the default (root) user.

Do you think this would fix the Not Authorized issue?

Ive figured out a better way of doing this now that will persist across container recreations - ill share tomorrow a bit more sober

The auth issue will likely be somethinf else (either API or as youre accessing from a docker IP) but im sure we’ll figure it out

1 Like

Use the mdhiggins version of sonarr (upstreams from Linuxserver but contains Python)

Then, in your file, alter the beginning part to be:


instead of


Very cool, thank you. I am going to try to get the whole thing working on what I have (so I can easily reset it) and when I fully understand what’s going on, I can move over to this version. I am not a yaml expert either and will need to modify the existing yaml that currently, neatly installs and upgrades my entire system.

I think the reason why we’re struggling with the script is because it’s assumed you’ll be running Sonarr on a system where you can easily install python i.e Windows or a LInux distribution and not inside a Docker container. I’m using it on a Synology NAS with a docker-compose file - now when an episode is downloaded it’ll automatically unmonitor rather than download an ‘upgrade’ (preferred words) even when I have upgrades disabled. The sonarr team have no interest in changing this behaviour but at least with some effort we can get this script working.

It works like a charm!
Thank you
Still having a error code 1 where my variables wasn’t passed so I wrote them directly in the script.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.