I am pretty new to python\'s urllib. What I need to do is set a custom header for the request being sent to the server. Specifically, I need to set the Content-type and Au
adding HTTP headers using urllib2:
from the docs:
import urllib2 req = urllib2.Request('http://www.example.com/') req.add_header('Referer', 'http://www.python.org/') resp = urllib2.urlopen(req) content = resp.read()