Message29118
Logged In: YES
user_id=226518
Cannot add attachment via upload so I put it here:
#!/usr/bin/python
# -*- coding: cp1250 -*-
import urllib
import urllib2
def get_page():
url = 'http://www.python.org'
print "trying %s ..." % (url)
# Setup proxy & authentication
proxy = "poczta.heuthes:8080"
usr1 = "USER"
pass1 = "PASSWD"
proxy_handler = urllib2.ProxyHandler({"http" : "http:/
/" + proxy})
pass_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
pass_mgr.add_password(None, "http://" + proxy, usr1,
pass1)
pass_mgr.add_password(None, proxy, usr1, pass1)
auth_handler = urllib2.HTTPBasicAuthHandler(pass_mgr)
proxy_auth_handler =
urllib2.ProxyBasicAuthHandler(pass_mgr)
# Now build a new URL opener and install it
opener = urllib2.build_opener(proxy_handler,
proxy_auth_handler, auth_handler, urllib2.HTTPHandler)
urllib2.install_opener(opener)
request = urllib2.Request(url)
f = urllib2.urlopen(request)
data = f.read()
print "OK. We have reply from %s.\nSize: %d [b]" %
(url, len(data))
if len(data) < 400:
print data
else:
print data[:200]
print "..."
print data[-200:]
get_page()
|
|
Date |
User |
Action |
Args |
2007-08-23 14:41:15 | admin | link | issue1519816 messages |
2007-08-23 14:41:15 | admin | create | |
|