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

Error when creating NotionClient #401

Open
gloriouslyawkwardlife opened this issue Jul 15, 2024 · 2 comments
Open

Error when creating NotionClient #401

gloriouslyawkwardlife opened this issue Jul 15, 2024 · 2 comments

Comments

@gloriouslyawkwardlife
Copy link

gloriouslyawkwardlife commented Jul 15, 2024

I have serious doubts that this is even an active project anymore, but in case:

>>> client = NotionClient(token_v2="<notion token_v2>")

File /opt/homebrew/lib/python3.12/site-packages/notion/client.py:77, in NotionClient.__init__(self, token_v2, monitor, start_monitoring, enable_caching, cache_key, email, password, client_specified_retry)
     66 def __init__(
     67     self,
     68     token_v2=None,
   (...)
     75     client_specified_retry=None,
     76 ):
---> 77     self.session = create_session(client_specified_retry)
     78     if token_v2:
     79         self.session.cookies = cookiejar_from_dict({"token_v2": token_v2})

File /opt/homebrew/lib/python3.12/site-packages/notion/client.py:39, in create_session(client_specified_retry)
     37     retry = client_specified_retry
     38 else:
---> 39     retry = Retry(
     40         5,
     41         backoff_factor=0.3,
     42         status_forcelist=(502, 503, 504),
     43         # CAUTION: adding 'POST' to this list which is not technically idempotent
     44         method_whitelist=(
     45             "POST",
     46             "HEAD",
     47             "TRACE",
     48             "GET",
     49             "PUT",
     50             "OPTIONS",
     51             "DELETE",
     52         ),
     53     )
     54 adapter = HTTPAdapter(max_retries=retry)
     55 session.mount("https://", adapter)

TypeError: Retry.__init__() got an unexpected keyword argument 'method_whitelist'


@michaelfromyeg
Copy link

I hit the same issue. Based on this discussion, it looks like a work-around is to downgrade urllib, i.e., run pip install 'urllib3<2'.

Can confirm after running this the repo works on Python 3.10!

@theflysurfer
Copy link

Actually, this repo does not seem updated, but this one uses the same core and is updated.

I ran some tests of the client and it works as expected

from csv2notion_neo.notion.client import NotionClient

# Obtain the `token_v2` value by inspecting your browser cookies on a logged-in (non-guest) session on Notion.so
client = NotionClient(
    token_v2="<token_v2>",
    workspace="<workspace_name>")

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

3 participants