thesadru / genshinstats

PLEASE USE GENSHIN.PY A python library that can get the stats of Genshin Impact players using Mihoyo's API. PLEASE USE GENSHIN.PY
https://thesadru.github.io/pdoc/genshinstats/
MIT License
265 stars 38 forks source link

SSL: CERTIFICATE_VERIFY_FAILED #29

Closed rushkii closed 3 years ago

rushkii commented 3 years ago

Hello, I was running my bot and hosted on Heroku, but sometimes it get the SSL error and sometimes it doesn't. How to solve this?

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1091)

thesadru commented 3 years ago

I'm gonna be honest I have no idea how SSL certificates work in requests or how can I fix a problem like this. I have never once gotten an error like this so all I can recommend is just checking out some StackOverflow answers and debugging yourself. Maybe just update your version of python/requests ¯\_(ツ)_/¯

If it happens only occasionally then I could just make genshinstats retry the request every time it fails but I'm not sure whether that'd work.

rushkii commented 3 years ago

I'm gonna be honest I have no idea how SSL certificates work in requests or how can I fix a problem like this. I have never once gotten an error like this so all I can recommend is just checking out some StackOverflow answers and debugging yourself. Maybe just update your version of python/requests ¯_(ツ)_/¯

If it happens only occasionally then I could just make genshinstats retry the request every time it fails but I'm not sure whether that'd work.

I've searched on stackoverflow, I think it's because of the verify=True like this answer:

https://stackoverflow.com/questions/10667960/python-requests-throwing-sslerror

thesadru commented 3 years ago

That's weird, the question you sent was posted a few years ago and since then this issue should've surely been resolved.

Could you please try doing genshinstats.genshinstats.session.verify = False and see if that solves the issue? I don't think it's a good idea to make the verification disabled by default.

rushkii commented 3 years ago

That's weird, the question you sent was posted a few years ago and since then this issue should've surely been resolved.

Could you please try doing genshinstats.genshinstats.session.verify = False and see if that solves the issue? I don't think it's a good idea to make the verification disabled by default.

I'll try it if it's get that error again.

rushkii commented 3 years ago

Hmm, and now I'm getting this error: requests.exceptions.HTTPError: 410 Client Error: Gone for url: https://bbs-api-os.hoyolab.com/game_record/card/wapi/getGameRecordCard?uid={censored_cuid}&gids=2

thesadru commented 3 years ago

I can't seem to reproduce this error. The endpoint still exists and works just fine. Did you get this error just once or consistently?

thesadru commented 3 years ago

I'll be closing this due to inactivity.