Search code examples
pythonheaderpycurl

Custom headers with pycurl


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


Solution

  • 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()