python httplib 401 Unauthorized 因为需要验证用户名和密码所以出错了,怎么办?能在代码中提交吗? 5
ifself.ssl:conn=httplib.HTTPSConnection(self.host,self.port)else:conn=httplib.HTTPCon...
if self.ssl:
conn = httplib.HTTPSConnection(self.host, self.port)
else:
conn = httplib.HTTPConnection(self.host, self.port)
try:
conn.request('GET', self.url)
response = conn.getresponse()
if response.status != 200:
print 'Server replied: %d %s to action GET %s' % (
response.status, response.reason, self.url)
sys.exit(1)
data = response.read()
...... 展开
conn = httplib.HTTPSConnection(self.host, self.port)
else:
conn = httplib.HTTPConnection(self.host, self.port)
try:
conn.request('GET', self.url)
response = conn.getresponse()
if response.status != 200:
print 'Server replied: %d %s to action GET %s' % (
response.status, response.reason, self.url)
sys.exit(1)
data = response.read()
...... 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询