theelous3 / asks

Async requests-like httplib for python.
MIT License
508 stars 63 forks source link

ValueError: 'go.magik.ly' does not appear to be an IPv4 or IPv6 address #163

Open septfish opened 4 years ago

septfish commented 4 years ago

I followed the official documentation and added a link to report this. Using curio ’s taskgroups, there were no errors. Can anyone help me explain what the reasons are and how to operate them correctly

carlbordum commented 4 years ago

Hi @septfish. Can you share a code snippet that gives this error?

thanks :-)

septfish commented 4 years ago

def test2(): results = {} url_list = ['http://www.baidu.com'] async def worker(key, url): r = await s.get(url) results[key] = r

async def main(url_list):
    url_dict = dict(enumerate(url_list))
    for key, url in url_dict.items():
        await curio.spawn(worker(key, url))

sorted_results = [response for _, response in sorted(results.items())]

s = asks.Session(connections=10)
curio.run(main(url_list))
return sorted_results