- Code: Select all
for id in range(10):
someURL = "http://fakeURL" + str(id)
data = get(someURL).json()
I am constantly getting the following error (I've pulled out host and specific port information, I hope that isn't the problem):
ConnectionError: HTTPConnecctionPool(host ="host", port=port#). Max retries exceeded with url: caused by class 'socket.error'. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host failed to respond.
At first I thought my requests were coming to fast so I put sleep lines in there to aid with that but I was still getting the error. Even if I run the code from the Python Shell I get it on the first try sometimes. However if I try to get the JSON data using my Chrome browser it works every time without issue. Which leads me to believe the offsite server is working fine. Any help is greatly appreciated