I have the following code:
import requests
requests.get('URL WITH PARAMS HERE', auth=('MY USERNAME', 'MY PASSWORD'))
It is used to hit an API, but it returns the following error: "socket.error: [Errno 104] Connection reset by peer"
I am able to retrieve results using my browser. I am also able to cURL it and get results. The same problem happens when using urllib2, but for some reason pycurl seems to retrieve results.
Is there any solution to make it work or any idea as to the problem?
Your code is correct. The error might mean that the server on the other end is unhappy about what you're sending. You have to make sure you send it an appropriate request. To do that, you can:
For the third option, use the integrated development tools on firefox, chrome, safari or your favorite browser (e.g for Firefox, read this)