Medusa icon indicating copy to clipboard operation
Medusa copied to clipboard

Trakt.tv API endpoint needs to be updated (api-v2launch.trakt.tv)

Open XxUnkn0wnxX opened this issue 6 months ago • 1 comments

Describe the bug trakt.tv changed their API end point as stated here: https://twitter.com/traktapi/status/1753116197229670524 trakt syncing, notification, add recommended shows no longer function

Screenshots Screen Shot 2024-02-02 at 1 23 45 pm Screen Shot 2024-02-02 at 1 23 37 pm Screen Shot 2024-02-02 at 1 23 24 pm

Medusa (please complete the following information):

  • OS: macOS 11.7.10
  • Branch: develop
  • Commit: bf956fc151055e644e017b74494115a397483266
  • Python version: 3.11.6
  • Database version: 44.19

Debug logs (at least 50 lines):

2024-02-02 13:18:16 ERROR    Thread_0 :: [bf956fc] Exception generated: 'MedusaApp' object has no attribute 'TRAKT_DEVICE_CODE'
Traceback (most recent call last):
  File "/Users/ovidijus/Apps/Medusa/medusa/server/web/core/base.py", line 252, in async_call
    result = function(**kwargs)
             ^^^^^^^^^^^^^^^^^^
  File "/Users/ovidijus/Apps/Medusa/medusa/server/web/home/handler.py", line 367, in checkTrakTokenOauth
    if not app.TRAKT_DEVICE_CODE.get('requested'):
           ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'MedusaApp' object has no attribute 'TRAKT_DEVICE_CODE'
2024-02-02 13:26:41 WARNING  POSTPROCESSQUEUE-POST-PROCESS :: [bf956fc] Unable to update Trakt: ConnectionError(MaxRetryError("HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /sync/collection (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x129ea2190>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))"))
Traceback (most recent call last):
  File "/Users/ovidijus/Apps/Medusa/ext/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ovidijus/Apps/Medusa/ext/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ovidijus/Apps/Medusa/ext/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/Users/ovidijus/Apps/Medusa/ext/urllib3/connectionpool.py", line 404, in _make_request
    self._validate_conn(conn)
  File "/Users/ovidijus/Apps/Medusa/ext/urllib3/connectionpool.py", line 1058, in _validate_conn
    conn.connect()
  File "/Users/ovidijus/Apps/Medusa/ext/urllib3/connection.py", line 363, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/Users/ovidijus/Apps/Medusa/ext/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x129ea2190>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known

pyMedusa Logs.zip

Additional context the new API endpoint is: https://api.trakt.tv

XxUnkn0wnxX avatar Feb 02 '24 02:02 XxUnkn0wnxX

@medariox please change on Medusa/ext/trakt/core.py, on line 31: BASE_URL = 'api-v2launch.trakt.tv' to BASE_URL = 'https://api.trakt.tv/'

I have tested this & it works fine, auth etc.. @farni from discord suggested this.

XxUnkn0wnxX avatar Feb 02 '24 07:02 XxUnkn0wnxX