Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base URL fails to resolve #216

Open
wfriesen opened this issue Feb 8, 2024 · 2 comments
Open

Base URL fails to resolve #216

wfriesen opened this issue Feb 8, 2024 · 2 comments

Comments

@wfriesen
Copy link

wfriesen commented Feb 8, 2024

The URL used by this project, that has been deprecated for some time, is now officially retired. When attempting to use this project now, an error like the following occurs

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /users/xxxxxxx (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f83207ae110>: Failed to resolve 'api-v2launch.trakt.tv' ([Errno -2] Name does not resolve)"))

This project seems to be abandoned, so there are two options.

Monkey patch anything importing this project by updating the base url with this:

trakt.core.BASE_URL = "https://api.trakt.tv/"

Or, switch to this fork: https://github.com/glensc/python-pytrakt
Being an active fork, development has naturally moved on, so it is not a drop-in replacement, but for my uses there wasn't much to change.

@glensc
Copy link
Contributor

glensc commented Feb 9, 2024

The repo owner has ghosted this repo:

and it is drop in replacement. you maybe want to submit a pull request there with instructions how to switch.

@wfriesen
Copy link
Author

wfriesen commented Feb 9, 2024

Something has changed to do with the TVSeason object

~/pytrakt $ cat dropin.py
from trakt.users import User
import trakt

trakt.core.BASE_URL = "https://api.trakt.tv/"

trakt.core.AUTH_METHOD = trakt.core.OAUTH_AUTH

user = User("xxxxxxxx")
print(user.watched_shows[0].seasons[0]["episodes"])
 ~/pytrakt $ python -m venv venv
 ~/pytrakt $ source ./venv/bin/activate
 venv $ ~/pytrakt $ pip install trakt
Collecting trakt
  Using cached trakt-3.4.0-py3-none-any.whl (37 kB)
Collecting requests>=2.25 (from trakt)
  Obtaining dependency information for requests>=2.25 from https://files.pythonhosted.org/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl.metadata
  Using cached requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Collecting requests-oauthlib>=1.3 (from trakt)
  Using cached requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)
Collecting charset-normalizer<4,>=2 (from requests>=2.25->trakt)
  Obtaining dependency information for charset-normalizer<4,>=2 from https://files.pythonhosted.org/packages/40/26/f35951c45070edc957ba40a5b1db3cf60a9dbb1b350c2d5bef03e01e61de/charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
  Using cached charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (33 kB)
Collecting idna<4,>=2.5 (from requests>=2.25->trakt)
  Obtaining dependency information for idna<4,>=2.5 from https://files.pythonhosted.org/packages/c2/e7/a82b05cf63a603df6e68d59ae6a68bf5064484a0718ea5033660af4b54a9/idna-3.6-py3-none-any.whl.metadata
  Using cached idna-3.6-py3-none-any.whl.metadata (9.9 kB)
Collecting urllib3<3,>=1.21.1 (from requests>=2.25->trakt)
  Obtaining dependency information for urllib3<3,>=1.21.1 from https://files.pythonhosted.org/packages/88/75/311454fd3317aefe18415f04568edc20218453b709c63c58b9292c71be17/urllib3-2.2.0-py3-none-any.whl.metadata
  Using cached urllib3-2.2.0-py3-none-any.whl.metadata (6.4 kB)
Collecting certifi>=2017.4.17 (from requests>=2.25->trakt)
  Obtaining dependency information for certifi>=2017.4.17 from https://files.pythonhosted.org/packages/ba/06/a07f096c664aeb9f01624f858c3add0a4e913d6c96257acb4fce61e7de14/certifi-2024.2.2-py3-none-any.whl.metadata
  Using cached certifi-2024.2.2-py3-none-any.whl.metadata (2.2 kB)
Collecting oauthlib>=3.0.0 (from requests-oauthlib>=1.3->trakt)
  Using cached oauthlib-3.2.2-py3-none-any.whl (151 kB)
Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Using cached certifi-2024.2.2-py3-none-any.whl (163 kB)
Using cached charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (140 kB)
Using cached idna-3.6-py3-none-any.whl (61 kB)
Using cached urllib3-2.2.0-py3-none-any.whl (120 kB)
Installing collected packages: urllib3, oauthlib, idna, charset-normalizer, certifi, requests, requests-oauthlib, trakt
Successfully installed certifi-2024.2.2 charset-normalizer-3.3.2 idna-3.6 oauthlib-3.2.2 requests-2.31.0 requests-oauthlib-1.3.1 trakt-3.4.0 urllib3-2.2.0

[notice] A new release of pip is available: 23.2.1 -> 24.0
[notice] To update, run: pip install --upgrade pip
 venv $ ~/pytrakt $ python dropin.py
[{'number': 1, 'plays': 1, 'last_watched_at': '2024-02-07T09:23:02.000Z'}, {'number': 2, 'plays': 1, 'last_watched_at': '2024-02-08T09:44:52.000Z'}, {'number': 3, 'plays': 1, 'last_watched_at': '2024-02-09T07:13:37.000Z'}]
 venv $ ~/pytrakt $ deactivate
 ~/pytrakt $ rm -rf venv
 ~/pytrakt $ python -m venv venv
 ~/pytrakt $ source ./venv/bin/activate
 venv $ ~/pytrakt $ pip install pytrakt
Collecting pytrakt
  Obtaining dependency information for pytrakt from https://files.pythonhosted.org/packages/6d/84/84feebf670032535aa5ece2fb49e6b5c3bc021760cec07460bf4092f7c58/pytrakt-3.4.29-py3-none-any.whl.metadata
  Using cached pytrakt-3.4.29-py3-none-any.whl.metadata (13 kB)
Collecting deprecated~=1.2.13 (from pytrakt)
  Obtaining dependency information for deprecated~=1.2.13 from https://files.pythonhosted.org/packages/20/8d/778b7d51b981a96554f29136cd59ca7880bf58094338085bcf2a979a0e6a/Deprecated-1.2.14-py2.py3-none-any.whl.metadata
  Using cached Deprecated-1.2.14-py2.py3-none-any.whl.metadata (5.4 kB)
Collecting requests-oauthlib>=1.3 (from pytrakt)
  Using cached requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)
Collecting requests>=2.25 (from pytrakt)
  Obtaining dependency information for requests>=2.25 from https://files.pythonhosted.org/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl.metadata
  Using cached requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Collecting wrapt<2,>=1.10 (from deprecated~=1.2.13->pytrakt)
  Obtaining dependency information for wrapt<2,>=1.10 from https://files.pythonhosted.org/packages/6e/52/2da48b35193e39ac53cfb141467d9f259851522d0e8c87153f0ba4205fb1/wrapt-1.16.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
  Using cached wrapt-1.16.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.6 kB)
Collecting charset-normalizer<4,>=2 (from requests>=2.25->pytrakt)
  Obtaining dependency information for charset-normalizer<4,>=2 from https://files.pythonhosted.org/packages/40/26/f35951c45070edc957ba40a5b1db3cf60a9dbb1b350c2d5bef03e01e61de/charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
  Using cached charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (33 kB)
Collecting idna<4,>=2.5 (from requests>=2.25->pytrakt)
  Obtaining dependency information for idna<4,>=2.5 from https://files.pythonhosted.org/packages/c2/e7/a82b05cf63a603df6e68d59ae6a68bf5064484a0718ea5033660af4b54a9/idna-3.6-py3-none-any.whl.metadata
  Using cached idna-3.6-py3-none-any.whl.metadata (9.9 kB)
Collecting urllib3<3,>=1.21.1 (from requests>=2.25->pytrakt)
  Obtaining dependency information for urllib3<3,>=1.21.1 from https://files.pythonhosted.org/packages/88/75/311454fd3317aefe18415f04568edc20218453b709c63c58b9292c71be17/urllib3-2.2.0-py3-none-any.whl.metadata
  Using cached urllib3-2.2.0-py3-none-any.whl.metadata (6.4 kB)
Collecting certifi>=2017.4.17 (from requests>=2.25->pytrakt)
  Obtaining dependency information for certifi>=2017.4.17 from https://files.pythonhosted.org/packages/ba/06/a07f096c664aeb9f01624f858c3add0a4e913d6c96257acb4fce61e7de14/certifi-2024.2.2-py3-none-any.whl.metadata
  Using cached certifi-2024.2.2-py3-none-any.whl.metadata (2.2 kB)
Collecting oauthlib>=3.0.0 (from requests-oauthlib>=1.3->pytrakt)
  Using cached oauthlib-3.2.2-py3-none-any.whl (151 kB)
Using cached pytrakt-3.4.29-py3-none-any.whl (39 kB)
Using cached Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)
Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Using cached certifi-2024.2.2-py3-none-any.whl (163 kB)
Using cached charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (140 kB)
Using cached idna-3.6-py3-none-any.whl (61 kB)
Using cached urllib3-2.2.0-py3-none-any.whl (120 kB)
Using cached wrapt-1.16.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (80 kB)
Installing collected packages: wrapt, urllib3, oauthlib, idna, charset-normalizer, certifi, requests, deprecated, requests-oauthlib, pytrakt
Successfully installed certifi-2024.2.2 charset-normalizer-3.3.2 deprecated-1.2.14 idna-3.6 oauthlib-3.2.2 pytrakt-3.4.29 requests-2.31.0 requests-oauthlib-1.3.1 urllib3-2.2.0 wrapt-1.16.0

[notice] A new release of pip is available: 23.2.1 -> 24.0
[notice] To update, run: pip install --upgrade pip
 venv $ ~/pytrakt $ python dropin.py
Traceback (most recent call last):
  File "/home/william/pytrakt/dropin.py", line 9, in <module>
    print(user.watched_shows[0].seasons[0]["episodes"])
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
TypeError: 'TVSeason' object is not subscriptable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants