Skip to content Skip to sidebar Skip to footer

`no Module Named 'urllib2' - How Do I Use It In Python So I Can Make A Request

Python newbie and just not sure what to do for python I want to use urllib2 - Request to make a call How can I do that, for example in the repl. I can't figure out the right way $

Solution 1:

There is no urllib2 in python3; see this question for more details. (The short version of the backstory here is that Python2 and Python3 are entirely different types of flying altogether; not all stdlib libraries in Py2 are available in Py3.)

Instead, try urllib (similar API);

from urllib import request

You can hit the urllib documentation here, which may help.

Post a Comment for "`no Module Named 'urllib2' - How Do I Use It In Python So I Can Make A Request"