下面是一个简单的 snippet:
import httplib
conn = httplib.HTTPConnection( 'www.yahoo.com' )
res = conn.request( 'GET', '/', headers = {'User-Agent': ua, 'Cookie': cookie })
if res.status == 200:
html = res.read()
# parse the html
else:
print res.status, res.reason
No comments:
Post a Comment