This recipe shows how you can grab a document from the web using urllib.py.
1 2 3 4 | from urllib import urlopen
doc = urlopen("http://www.python.org").read()
print doc
|
Tags: web
This recipe shows how you can grab a document from the web using urllib.py.
1 2 3 4 | from urllib import urlopen
doc = urlopen("http://www.python.org").read()
print doc
|
Grab a document from the web. This is an amazing example of the power of python. These one-liners are great for beginners like me who want to tap into this power right up front!
How about a "Python Power" category for these simple but "not so obvious to the newbie" power tips.
Adding support for proxy. Nice, but any real-life usage require a proxy.
Proxy in python. Set an environment variable HTTP_PROXY to your proxyserver:port So it'll look something like this:
set HTTP_PROXY=http://proxy.domain.com:8080
You need to have the http:// in front... or else it won't work!
Cheers,
Kraulin
Support for proxy authentication? Is there any way to work with a proxy server that requires authentication?
Proxy auth urllib. There is an example here:
thats the thing about python, simple yet so powerful.