pycrul模块 抓取页面

import pycurl
 
c = pycurl.Curl()
c.setopt(c.URL, 'http://news.ycombinator.com')
c.perform()

import pycurl   import cStringIO
 buf = cStringIO.StringIO()
 
c = pycurl.Curl()
c.setopt(c.URL, 'http://news.ycombinator.com')
c.setopt(c.WRITEFUNCTION, buf.write)
c.setopt(c.CONNECTTIMEOUT, 5)
c.setopt(c.TIMEOUT, 8)
c.setopt(c.PROXY, 'http://inthemiddle.com:8080')
c.perform() 
print buf.getvalue()
buf.close()


你可能感兴趣的:(import,抓取页面)