hentai-chan/hentai

error when trying to access nhentai.net

apoleon33 opened this issue ยท 6 comments

I got this error everytime I try to use any function of the api:

requests.exceptions.ConnectionError:` HTTPSConnectionPool(host='nhentai.net', port=443): Max retries exceeded with url: /api/gallery/123456789 (Caused by ReadTimeoutError("HTTPSConnectionPool(host='nhentai.net', port=443): Read timed out. (read timeout=5)"))

I don't have any idea to fix it

im using:

I don't think it's a bug, so i did not used the template to make this issue ^^

When making requests, ReadTimeoutErrors often occur because the server detected an unusual amount of traffic coming from your IP. It should allow requests after an unspecified amount of time again. Try it again in a few hours (or tomorrow). As a word of warning, when this pattern of making excessive requests reoccurs, you can be blocked by the site owner completely. I am not sure if that's what happened, so I am taking a wild guess here. You can configure a stricter retry_strategy in the handler property, but again - for most use cases the default settings should have you covered. Just don't attempt to scrap the whole website ;)

Please report back tomorrow to let me know if this issue persists and go over your script again to rule out any mistakes on your part.

is using a vpn on my whole pc might work?

It should work with a VPN because I added the urlib.request.getproxies() as keyword argument to each GET request, but I have never tested this myself because I don't use a VPN. Another reason why ReadTimeoutErrors might occur is when the site is offline (which is not the case) or when someone edited your HOST file to block access to sites with adult content. Since I cannot reproduce this error at home, this issue seems to be specific to you. Can you still access the website through the browser normally?

EDIT: In addition to my last question, could you run functions from this module before or did this error occur immediately upon first contact?

i think i know why it does not work

i tried to connect from a browser and i ended up with this:

noice

in french, it means:

You have been redirected to this page because you are trying to connect to a site with child pornography picture

Basically nhentai is blocked in France and i didn't even knew.

so yeah a vpn should solve this problem

Yes, that was a very important insight. I mentioned this issue in the documentation. In this case, a VPN would be necessary to circumvent this ban. I guess this resolves your problem for now. Well, not really, but at least we know the cause of it. Feel free to open another issue if it should still not work even with a VPN, until then I'll close this issue for now.