views:

54

answers:

2

Hi i'm wondering if i can send a custom header like "yadayadayad" to the server with the pycurl requsest ? Thanks :)

+2  A: 

I would code something like:

pycurl_connect = pycurl.Curl()
pycurl_connect.setopt(pycurl.URL, your_url)
pycurl_connect.setopt(pycurl.HTTPHEADER, ['header_name: header_value'])
pycurl_connect.perform()
systempuntoout
thanks mate ! :)
Pockata
@Pockata you are welcome
systempuntoout
A: 

you can, with HTTPHEADER. just provide your custom headers as a list, like so:

header = ['test: yadayadayada', 'blahblahblah']

curl.setopt(pycurl.HTTPHEADER, header)

maranas