Search code examples
pythondocumentationaiohttp

Aiohttp errno codes documentation ? Errno -2 / 111 / 113 / 104 / 101


I am encountering a wide variety of error codes while scraping through a list of urls.

Heres a outtake I have currently encountered:

[Errno -2] Cannot connect to host msecnd.net:80 ssl:False [Name or service not known]
...
[Errno 113] Cannot connect to host ru4.com:80 ssl:False [Can not connect to ru4.com:80 [Connect call failed ('75.98.46.13', 80)]]
...
[Errno 111] Cannot connect to host mail.me.com.akadns.net:80 ssl:False [Can not connect to mail.me.com.akadns.net:80 [Connect call failed ('17.172.34.92', 80)]]
...
[Errno 104] Connection reset by peer
...
[Errno 101] Cannot connect to host mqtt.c10r.facebook.com:80 ssl:False [Can not connect to mqtt.c10r.facebook.com:80 [Network is unreachable]]

However I cannot find any clear documentation on how to avoid these errors. Errno -2 is caused by invalid cert chain, but I cannot find how I can fix this issue on my machine. Errno 113 is connection refused or no route to host The other errnos are not very well documented.

My question is: How can I find the documentation that describes these error codes and additionally how can I handle them the best way ?


Solution

  • aiohttp has no specific error codes, you are observing standard OSError exceptions from python internals.

    https://docs.python.org/3/library/errno.html could help. Or even better google query like errno 101 return comprehensive list of articles.