Python 2 -> 3, urllib.urlOpen

boB Stepp robertvstepp at gmail.com
Fri Oct 13 18:46:40 EDT 2017


On Fri, Oct 13, 2017 at 5:27 PM, Irv Kalb <Irv at furrypants.com> wrote:

> I've looked at the Python 3.6 documentation for urllib, and I see that certain calls have been changed and others have been eliminated.  But my eyes glaze over trying to figure out what to use instead.
>
> My question is: Is there a simple (hopefully one or two line) replacement for my call to url lib.urlopen(<URL>).read()

I don't know much about this, but might you be looking for
urllib.request.urlopen()?  See

https://docs.python.org/3/library/urllib.request.html#module-urllib.request

in the docs.

> I know that there are other modules out there that handle requests (like the Requests module), but this is a strictly controlled university environment.  I cannot download any external packages (other then pygame, which I got special permission for) onto the computers in the school.  Therefore, I'm looking for something in the Python 3.6 Standard Library.

The above is in the standard library.
-- 
boB



More information about the Python-list mailing list