Python api request fails and reports ssl error

Viewed 59

I am trying to scrape data from wikipedia using their api; I am able to open the api link in my browser, but when I run the following code:

url = 'https://en.wikipedia.org/w/api.php?action=query&titles=belgrade&prop=extracts|pageimages|info&pithumbsize=400&inprop=url&redirects=&format=json&origin=*'
response = requests.get(url)

The program runs for a long time before finally producing a

'MaxRetryError' caused by 'EOF occurred in violation of protocol (_ssl.c:1125)')))"),) error.

I'm running it in jupyter notebooks, but I tried it in iPython from the terminal too and it did not work either. I know sll.c:1125 has something vaguely to do with when HTTP assets attempt to be delivered over an HTTPS domain, but I have no idea how it applies here. Any help is appreciated!

0 Answers
Related