Skip to content

async client raises IPv4 or IPv6 address ValueError for URL "https://eodhistoricaldata.com" #2166

Closed

Description

@topher-lo

Current Behaviour

OS platform

  • WSL Ubuntu 20.04

Python version

  • Python 3.9

Dependencies

  • Just httpx and asyncio
import asyncio
import httpx

async def get():
  r = await httpx.get("https://eodhistoricaldata.com")
  print(r)

asyncio.run(get())

Causes the following error:

Traceback (most recent call last):
  File "/home/USER/miniconda3/envs/project/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 149, in connect_tcp
    addr_obj = ip_address(remote_host)
  File "/home/USER/miniconda3/envs/project/lib/python3.9/ipaddress.py", line 53, in ip_address
    raise ValueError('%r does not appear to be an IPv4 or IPv6 address' %
ValueError: 'eodhistoricaldata.com' does not appear to be an IPv4 or IPv6 address

However using the synchronous client does not raise any error:

>>> import requests
>>> requests.get("https://eodhistoricaldata.com")
<Response [200]>

Expected Behaviour

Activity

  1. topher-lo commented on Apr 5, 2022

    @topher-lo
    Author

    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():
      r = await httpx.get("http://nonsecure.eodhistoricaldata.com/")
      print(r)
    
    asyncio.run(get())
  2. lovelydinosaur commented on Apr 5, 2022

    @lovelydinosaur
    Member

    Doesn't replicate for me...

    >>> import httpx
    >>> httpx.get("https://eodhistoricaldata.com")
    <Response [200 OK]>
  3. locked and limited conversation to collaborators on Apr 5, 2022
  4. converted this issue into a discussion #2167 on Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions