[Tutor] getting binary file from website with custom header

Steven D'Aprano steve at pearwood.info
Sat Jan 29 05:34:26 CET 2011


Alex Hall wrote:

> I keep getting an error 403, which the api defines as a bad login
> attempt. 

This could mean anything. Perhaps your password is wrong. Perhaps your 
username is wrong. Perhaps the website is sniffing the user-agent and 
refusing to allow Python to connect. Try setting the user-agent to the 
same one Firefox or Internet Explorer use:

http://www.voidspace.org.uk/python/articles/urllib2.shtml#id15



-- 
Steven



More information about the Tutor mailing list