Closed falkyre closed 8 months ago
Sure I can work on this.
@falkyre Do you remember which endpoint was causing this ssl issue? I wanted to see if I could replicate it to confirm a fix.
I'll check with the user who reported it in our discord and get you that info once he comes back to me
Looks like line 39 in the standings.py.
File "/usr/local/lib/python3.9/dist-packages/nhlpy/api/standings.py", line 39, in get_standings
v2.4.0
The httpx library that you are using is showing a couple of issues when we are using it in our project for our next version(https://github.com/riffnshred/nhl-led-scoreboard)
We are seeing a timeout:
File "/usr/local/lib/python3.9/dist-packages/httpx/_transports/default.py", line 79, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ReadTimeout: The read operation timed out
And an issue with SSL Verification (I believe this is likely because the Cloudflare Load Balancer that the NHL is using was returning a bad cert)
File "/usr/local/lib/python3.9/dist-packages/httpx/_transports/default.py", line 79, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'api-web.nhle.com'. (_ssl.c:1123)
With the httpx API you do have the ability to increase the time out and also disable SSL Verification. Would it be possible to add these as options to the NHLClient like you do with verbose logging?
https://www.python-httpx.org/advanced/#timeout-configuration
https://www.python-httpx.org/advanced/#ssl-certificates
I realize that turning off the SSL Verification is considered a bad idea but it is causing our scoreboard to crash. Having the option to allow a user to bypass the verification is a good option (as long as they understand the potential risk of doing this)