Creating an http request in python is quite ismple. If anything, there are to many options to get do it. My prefered way is to use the wonderful requests library. However, this library can be a bit slow for some used cases. I was facing just such a used case today.
urllib2 I didn’t expect any trouble. Unofrtunatley, taht was not the case. I was getting
401 errors and the response object was not set. It seemed like I was stuck with my debugging. I almost gave in and instaled requests when I came across this stackoverflow question. Seems that the error is what I needed to inspect (actually read). Calling
e.read() was all that was needed to show me what was actually going wrong with the requests.