samwiseg0 / better-discord-notifications

Scripts that send better sonarr/radarr notifications to discord
GNU General Public License v3.0
15 stars 0 forks source link

Unable to connect inside radarr container #6

Closed ADRFranklin closed 4 years ago

ADRFranklin commented 4 years ago

Hi,

I have managed to get sonarr to work perfectly fine using v3, I just attempted to get radarr v3 to work but for some reason it refuses to connect using:

http://localhost:7878/

I went into the container and I curl the api like so

curl http://localhost:7878/api/movie/10?apikey=<key>

and did get a json output with the movies content.

Now the error that is given by the script is

Traceback (most recent call last):
  File "/home/michael/scripts/better-discord-notifications/docker/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/home/michael/scripts/better-discord-notifications/docker/urllib3/util/connection.py", line 83, in create_connection
    raise err
  File "/home/michael/scripts/better-discord-notifications/docker/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/michael/scripts/better-discord-notifications/docker/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/home/michael/scripts/better-discord-notifications/docker/urllib3/connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/home/michael/scripts/better-discord-notifications/docker/urllib3/connection.py", line 166, in connect
    conn = self._new_conn()
  File "/home/michael/scripts/better-discord-notifications/docker/urllib3/connection.py", line 150, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fbbc5a7f9e8>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/michael/scripts/better-discord-notifications/docker/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/home/michael/scripts/better-discord-notifications/docker/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/michael/scripts/better-discord-notifications/docker/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=7878): Max retries exceeded with url: /api/movie/10?apikey=<key> (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fbbc5a7f9e8>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./radarr_discord.py", line 82, in <module>
    radarr = requests.get(radarr_api_url)
  File "/home/michael/scripts/better-discord-notifications/docker/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/home/michael/scripts/better-discord-notifications/docker/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/michael/scripts/better-discord-notifications/docker/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/michael/scripts/better-discord-notifications/docker/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/home/michael/scripts/better-discord-notifications/docker/requests/adapters.py", line 508, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=7878): Max retries exceeded with url: /api/movie/10?apikey=<key> (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fbbc5a7f9e8>: Failed to establish a new connection: [Errno 111] Connection refused'))

I have never really used python, so my skills in debugging are extremely limited.

samwiseg0 commented 4 years ago

Where are you running the script? Have you tried using the built in test option in radarr?

ADRFranklin commented 4 years ago

Yes radarr's test feature fails with script error 127.

The script is mounted inside the container under /scripts

samwiseg0 commented 4 years ago

Can you look at the radarr logs and see the error?

You posted /home/michael/scripts/. So I can assume when you ran the script, it was not inside the container?

samwiseg0 commented 4 years ago

You can test inside the container by doing the following: Shell into the container:

docker exec -it CONTAINER_NAME /bin/bash

Inside the container:

cd /scripts/better-discord-notifications/docker
radarr_eventtype='test' bash -c 'python3 radarr_discord.py'
ADRFranklin commented 4 years ago

python3 is not installed in the linuxserver.io image? Doesn't seem like I am able to find it.

samwiseg0 commented 4 years ago

Nope you have to use https://hub.docker.com/r/hotio/radarr for python3 https://github.com/Radarr/Radarr/wiki/Docker#pick-stable-or-nightly

ADRFranklin commented 4 years ago

Okay thanks, moving to hotio version seems to work.