问题
I am using the API for challonge and their url format is https://username:password@challonge.com/api/ However, when the use urllib2 in python to get this url, response = urllib2.urlopen('https://username:password@challonge.com/api/'), I get an error about a non-numerical port number. I believe this is cause by the colon (:) in the url making urllib2 think i'm trying to get a port of something. Is there anyway around this issue, or am I doing something wrong?
回答1:
This is because you must use auth handlers like urllib2.HTTPBasicAuthHandler or other. urllib2 docs
来源:https://stackoverflow.com/questions/9696999/urllib2-having-trouble-processing-colon-symbol-in-url