tags:

views:

66

answers:

1

I'm using urlretrieve from the urllib module.

I cannot seem to find how to add a User-Agent description to my requests.


Is it possible with urlretrieve? or do I need to use another method?

+2  A: 

I don't think it's possible with urlretrieve - at least not easily. I would propose to create an urllib2.Request object and pass the required headers to it. See

http://docs.python.org/library/urllib2.html#urllib2.urlopen

for examples.

Achim