curl-and-python

could not get all content from web

From: D.Y Feng <yyfeng88625_at_gmail.com>
Date: Wed, 17 Nov 2010 19:47:42 +0800

   Hi
     when i use the pycurl,i meet a big problem.when the html data is
   bigger than 4k,the perform()could not get the all content from web.
    here is the code
       def curl_wirte(self,buf):
           self.contents+=buf
       def init_curl(self):
           self.curl_handel.setopt(pycurl.WRITEFUNCTION,self.curl_wirte)
           self.curl_handel.setopt(pycurl.FOLLOWLOCATION, 1)
           self.curl_handel.setopt(pycurl.MAXREDIRS, 5)
           self.curl_handel.setopt(pycurl.CONNECTTIMEOUT, 20)
           self.curl_handel.setopt(pycurl.TIMEOUT, 20)
       def curl_exec(self,url):
               self.curl_handel.setopt(pycurl.URL,url)
               self.curl_handel.perform()
               result=self.contents
               self.contents=""
               return result
   Thank you
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2010-11-17