requests.exceptions.SSLError: HTTPSConnectionPool

I am running a simple code on the Replit, but I get an error. This code worked a week ago, but it doesn’t work now. The url is accessible and works from the browser without problems. Searching for solutions on the Internet did not lead to results. Please help me, how can I fix the error?

import requests
url = 'https://iss.moex.com/iss/statistics/engines/stock/markets/index/analytics.csv'
print(url)
r = requests.get(url).text
print (r)
Traceback (most recent call last):....
requests.exceptions.SSLError: HTTPSConnectionPool(host='iss.moex.com', port=443): Max retries exceeded with url: /iss/statistics/engines/stock/markets/index/analytics.csv (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1007)')))

Welcome to the Replit Ask forum!

The URL doesn’t seem to be accessible from the browser based on what I saw, are you sure it’s working?

2 Likes

I thought the same thing at first. I checked the site from the browser, it works.

I don’t know for sure. Does the website work for you? Because for me it will never load.

this code works fine in jupyter-notebook, but it doesn’t work in replit.

Where is this Jupyter notebook hosted, if it’s okay for me to ask? There is a difference between could-hosted notebooks and local ones.

Just tested it on Google Colab and it doesn’t work there too, got the same error.

ConnectTimeout                            Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    505                 # TODO: Remove this in 3.0.0: see #2811
    506                 if not isinstance(e.reason, NewConnectionError):
--> 507                     raise ConnectTimeout(e, request=request)
    508 
    509             if isinstance(e.reason, ResponseError):

ConnectTimeout: HTTPSConnectionPool(host='iss.moex.com', port=443): Max retries exceeded with url: /iss/statistics/engines/stock/markets/index/analytics.csv (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7d3ad673a530>, 'Connection to iss.moex.com timed out. (connect timeout=None)'))

jupyter is a local laptop

what can be done in this case? The site is accessible from the browser.

After some searching, I think I’ve found the issue. This may probably be caused by the fact that this website is a Russian one (stock exchange), while Replit servers are hosted in India and The US. That means that most Russian websites are inaccessible from any repls hosted on the platform. Not sure, but this might be the origin of the problem.

I think it might be true. But a week ago, this code was working in replit. What could have changed during this time?

No idea. Sometimes Replit IP addresses get banned by website hosters, so the owners of that website may have done that. The best way to find out, however, is to seek any official warnings or announcements from their side.

2 Likes

The problem solved itself. It seems that requests were indeed blocked on the site moex.com

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.