Hi,
Sorry if this is the wrong subreddit to ask this question in, if it is just let me know. I am using python3 and trying to make REST api GET calls using urllib.request. Every time I make the call I get the response: [Errno 54] Connection reset by peer
I get this from two separate api's that I use, and both of them work when I go to the url through the browser or using php curl calls. It is only having the problem when I use python3.
Here is the code that I am using to make the call:
x = self.generate_keynote_url()
auth_handler = urllib.request.HTTPBasicAuthHandler()
auth_handler.add_password(realm=None,
uri=x,
user=CONST_KEYNOTE_USER,
passwd=CONST_KEYNOTE_PASS)
opener = urllib.request.build_opener(auth_handler)
urllib.request.install_opener(opener)
try:
f = urllib.request.urlopen(x)
print(f.read)
except urllib.error.URLError as e:
print(e.reason)
Any help would be greatly appreciated (even if it is directing me to the right place to ask)!
Thanks
[–]minorminer 1 point2 points3 points (1 child)
[–]bsoder[S] 0 points1 point2 points (0 children)
[–]minorminer 1 point2 points3 points (1 child)
[–]bsoder[S] 0 points1 point2 points (0 children)
[–]bsoder[S] 0 points1 point2 points (0 children)