-
Current BehaviourOS platform
Python version
Dependencies
import asyncio
import httpx
async def get():
r = await httpx.get("https://eodhistoricaldata.com")
print(r)
asyncio.run(get()) Causes the following error:
However using the synchronous client does not raise any error:
Expected Behaviour
|
Beta Was this translation helpful? Give feedback.
Replies: 13 comments 19 replies
-
Contacted the EOD Historical Data team and they suggested using their http URL (which works on my end) import asyncio
import httpx
async def get():
async with httpx.AsyncClient() as c:
r = await httpx.get("http://nonsecure.eodhistoricaldata.com/")
print(r)
asyncio.run(get()) |
Beta Was this translation helpful? Give feedback.
-
Doesn't replicate for me... >>> import httpx
>>> httpx.get("https://eodhistoricaldata.com")
<Response [200 OK]> |
Beta Was this translation helpful? Give feedback.
-
running the demo I get:
|
Beta Was this translation helpful? Give feedback.
-
Update: See my comment below, this was a mixup on my end and I don't think httpx is misbehaving. @tomchristie @graingert I'm seeing the same error but with post, and I don't think the issue is related to async vs sync client. Our code, simplified, does this: client = httpx.AsyncClient(
base_url="https://vision.googleapis.com/v1",
auth=OAuthTokenAuth(...),
)
async def run():
response = await client.post(
"/images:annotate",
timeout=...,
json=...,
) I noticed this similar issue on uvicorn, in the fixing PR it seems like this is related to some underlying API not accepting hostnames when IPv6 addresses are expected? |
Beta Was this translation helpful? Give feedback.
-
We are running into this error, too, however it only occurs for the Mac users in our engineering team.
with On other platforms the requests just resolve fine. Very interesting to observe that for the affected developers, running an async shell via |
Beta Was this translation helpful? Give feedback.
-
Any fix for this yet? Running EDIT: it works fine when run outside of docker. I guess it's a docker problem then. Weird that the exception occurs after some time and not immediately |
Beta Was this translation helpful? Give feedback.
-
I'm having the same issue with What solved the issue for me was to specify the dns when running the container with the I hope it helps. |
Beta Was this translation helpful? Give feedback.
-
I don't know if this is really the same error but here's the stack trace that I am getting. The weird thing is that this seems to be platform-dependent. I don't have the problem on MacOS at all. This only happens on my Linux machine (details posted below the stack trace). Stack trace
Version information
Linux host (gets the error):
MacOS host (works fine):
|
Beta Was this translation helpful? Give feedback.
-
Any fix for this error? I keep getting it randomly with the Github API. The following is the stacktrace (for me it happens on Linux):
|
Beta Was this translation helpful? Give feedback.
-
I keep getting this randomly |
Beta Was this translation helpful? Give feedback.
-
@tomchristie FYI we don't get a Timeout, but our stacktrace looks like this:
|
Beta Was this translation helpful? Give feedback.
-
Is this related with python/cpython#112169 ? 🤔 |
Beta Was this translation helpful? Give feedback.
-
We're getting a similar Exception with the following stack trace below. The top-level Exception is httpx.ConnectError but it seems the underlaying cause for all of this is a string being passed to the ip_address that's part of the Python distribution. I suspect this is an issue in anyio passing a hostname string instead of an ip address string for some reason but I haven't really investigated this thoroughly.
|
Beta Was this translation helpful? Give feedback.
running the demo I get: