Useful Python stuff

Web Access

It easy to manipulate web based data/pages using Python...once you've dealt with the proxy firewall. The following example shows how:
#!/opt/graphics/cdat/bin/python
import urllib2
import getpass

proxypass=getpass.getpass("Enter proxy password:")
httpproxy="wwwcache.rdg.ac.uk:8080"
proxyuser="your proxy userid"
proxy=urllib2.ProxyHandler({"http":'http://'+proxyuser+':'+proxypass+'@'+httpproxy})
authinfo=urllib2.HTTPBasicAuthHandler()
opener=urllib2.build_opener(proxy, authinfo,urllib2.HTTPHandler)
urllib2.install_opener(opener)

webget=urllib2.urlopen('http://news.bbc.co.uk/')
print webget.read()
Steve George | steve.george@canterbury.ac.nz
Last Updated : Wed Nov 8 15:44:06 NZDT 2006