Custom headers with pycurl

Pockata picture Pockata · Jun 15, 2010 · Viewed 27k times · Source

Can I send a custom header like "yaddayadda" to the server with the pycurl request?

Answer

systempuntoout picture systempuntoout · Jun 15, 2010

I would code something like:

pycurl_connect = pycurl.Curl()
pycurl_connect.setopt(pycurl.URL, your_url)
pycurl_connect.setopt(pycurl.HTTPHEADER, ['header_name1: header_value1',
                                          'header_name2: header_value2'])
pycurl_connect.perform()