0

If the proxy is 200.217.241.76 and the port is 80 how can i connect to google.com and read the html code using that proxy?

My problem is to establish the connection i know how to read the html file when i get it, i want to automate a script that keep on reading different html files and save the data.

what i have now :

import urllib
html = urllib.openurl("http://google.com").read()
# do stuff with html

an example would be great !

agf
  • 171,228
  • 44
  • 289
  • 238
nmnm
  • 79
  • 2
  • 3

1 Answers1

0

urllib honors the system proxy settings:

The urlopen() function works transparently with proxies which do not require authentication. In a Unix or Windows environment, set the http_proxy, or ftp_proxy environment variables to a URL that identifies the proxy server before starting the Python interpreter. For example (the '%' is the command prompt):

> % http_proxy="http://www.someproxy.com:3128" 
> % export http_proxy 
> % python ...

enter link description here