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

httpx 0.25.x is not compatible with notion client: "TypeError: ConnectionPool.__init__() got an unexpected keyword argument 'socket_options'" #213

Closed
finaldie opened this issue Nov 22, 2023 · 4 comments

Comments

@finaldie
Copy link

Hi,

Encounter an exception when recently upgrading the environment, later found that the root cause is the httpx upgrading (from 0.24.1 to 0.25.1) breaks it.

Tested notion-client versions: 2.1.0, 2.0.0
Tested httpx versions:

  • 0.25.1: Bad
  • 0.25.0: Bad
  • 0.24.1: Good

The failure logs from httpx 0.25.x + notion client:

File "/opt/***/run/auto-news/src/notion.py", line 23, in _init_client
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -     return Client(auth=api_key)
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -            ^^^^^^^^^^^^^^^^^^^^
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -   File "/home/***/.local/lib/python3.11/site-packages/notion_client/client.py", line 159, in __init__
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -     client = httpx.Client()
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -              ^^^^^^^^^^^^^^
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -   File "/home/***/.local/lib/python3.11/site-packages/httpx/_client.py", line 672, in __init__
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -     self._transport = self._init_transport(
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -                       ^^^^^^^^^^^^^^^^^^^^^
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -   File "/home/***/.local/lib/python3.11/site-packages/httpx/_client.py", line 720, in _init_transport
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -     return HTTPTransport(
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -            ^^^^^^^^^^^^^^
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -   File "/home/***/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 136, in __init__
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -     self._pool = httpcore.ConnectionPool(
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO -                  ^^^^^^^^^^^^^^^^^^^^^^^^
[2023-11-21, 21:16:11 PST] {subprocess.py:93} INFO - TypeError: ConnectionPool.__init__() got an unexpected keyword argument 'socket_options'
[2023-11-21, 21:16:12 PST] {subprocess.py:97} INFO - Command exited with return code 1

Hope we can upgrade notion-client and fix the new httpx dependency failure issue and make it backward/forward compatible, thanks a lot.

@ramnes
Copy link
Owner

ramnes commented Nov 22, 2023

Hey there, thank you for raising this issue!

I can't replicate with 0.25.1, can you please provide a minimal reproducible example?

@ramnes
Copy link
Owner

ramnes commented Nov 22, 2023

I get the exact same error with httpcore==0.17.0, which is not supported by httpx anymore. I guess it's just a matter of updating httpcore on your side. :)

@ramnes
Copy link
Owner

ramnes commented Nov 22, 2023

encode/httpx#2937

@finaldie
Copy link
Author

finaldie commented Nov 22, 2023

@ramnes, thank you for the fast response, I verified from my environment and upgraded httpcore to 1.x, it works correctly. Before the httpx team releases a new version, I will pin httpcore>=0.17.2 as a workaround for now.

Thanks again!

@ramnes ramnes closed this as completed Nov 22, 2023
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