Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pycurl keeps printing in terminal

Tags:

python

pycurl

I am a beginner using Python and Pycurl for webpage stressing testing purposes. However, pycurl keeps printing out returned html in the terminal which makes the stress testing take even more time than it should. One such pycurl code I am using is posted below. Is there a way to just run pycurl without having to print or write the result anywhere? Any assistance would be appreiciated.

p = pycurl.Curl()
p.setopt(pycurl.POST, 0)
p.setopt(pycurl.COOKIE, sessioncookie)
p.setopt(pycurl.URL, 'http://example.com/logoff.php')
p.perform()
p.close()
like image 423
jyim89 Avatar asked Oct 05 '11 21:10

jyim89


1 Answers

The Pycurl documentation is terrible, but I think you want to set WRITEFUNCTION to a function that does nothing, e.g.

p.setopt(pycurl.WRITEFUNCTION, lambda x: None)

Also, I wish to state for the record that I thought "SET does everything" APIs went out with VMS. Gaaah.

like image 104
zwol Avatar answered Sep 30 '22 13:09

zwol