I need to use 'requests' and a function from urllib3
. In the code
you can see the requests
library is being imported, but at the same time it is a module/package inside urllib3
, which has already been imported too.
Doing some research I've found that Python comes with the urllib
package, that comes with the request
module. On the other hand, requests
is a module inside urllib3
, but it is a library on its own.
urllib
and urllib2
are standard Python librares, but urllib3
is a completely separated library with a confusing name. A portion of it has been included in the standard library and requests
depends on it, but it is not a newer version of urllib
/urllib2
; the library that actually wants to improve is httplib
(ref: Github).
"Under the hood, requests uses urllib3 to do most of the http heavy lifting. When used properly, it should be mostly the same unless you need more advanced configuration"(ref: Stackexchange):
I got to these conclusions but I'm still confused: if I have already imported urllib
, do I still need to import requests
? What if I had imported urllib3
?
Also, should requests
be imported separately, as in the depicted code, or should it be import imported from one of the mentioned libraries?