You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I benefit a lot from your Python course on LinkedIn. Thank you so much for such great sharing. Today, I run into one minor problem with the JSONData chapter, namely with this file:
The code runs perfectly with Python 3.9.16, but I use Python 3.11.4 for the learning purpose, then I got an error from this method urllib.request.urlopen(urlData), the terminal says:
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1002)>
The error screenshot looks like this:
I think this should be some kind of version incompatibility issue with Python. And after some investigation, I figure out this can be resolved with a ssl context as follows:
importurllib.requestimportssl# ...some other code logic ...urlData="https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_hour.geojson"context=ssl._create_unverified_context()
webUrl=urllib.request.urlopen(urlData, context=context)
print("result code:", str(webUrl.getcode()))
# ... some other code logic ...
Not sure if this is necessary to clarify in your demo code, I presume there will be more and more software developers using Python 3.11.4 above in the future who are going to take this course since it is so popular and practical, they would run into this problem as well.
Could you please help take a look this. Thank you!
The text was updated successfully, but these errors were encountered:
Hello Joe,
I benefit a lot from your Python course on LinkedIn. Thank you so much for such great sharing. Today, I run into one minor problem with the
JSONData
chapter, namely with this file:https://github.com/LinkedInLearning/learning-python-2896241/blob/main/Ch5%20-%20Internet%20Data/jsondata_finished.py
The code runs perfectly with
Python 3.9.16
, but I usePython 3.11.4
for the learning purpose, then I got an error from this methodurllib.request.urlopen(urlData)
, the terminal says:urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1002)>
The error screenshot looks like this:
I think this should be some kind of version incompatibility issue with Python. And after some investigation, I figure out this can be resolved with a ssl context as follows:
Not sure if this is necessary to clarify in your demo code, I presume there will be more and more software developers using
Python 3.11.4 above
in the future who are going to take this course since it is so popular and practical, they would run into this problem as well.Could you please help take a look this. Thank you!
The text was updated successfully, but these errors were encountered: