我正在尝试使用httplib
通过代理服务器向api.github.com
发出请求,但收到502
错误。仅供参考,curl, requests, wget
工作正常。
c = HTTPSConnection(host='192.168.1.1', port='8080')
c.set_tunnel('api.github.com', headers={'Proxy-Authorization': 'Basic ...'})
rh = {'Authorization': 'Basic ...', 'User-Agent': 'prboard/Python'}
url = '/users/kumarvaradarajulu/repos'
c.request('GET', url, 'null', rh)
r = c.getresponse()
我的状态为502
,输出如下所示。
<!DOCTYPE html>\n<!--\n\nHello future GitHubber! I bet you\'re here to remove those nasty inline styles,\nDRY up these templates and make \'em nice and re-usable, right?\n\nPlease, don\'t. https://github.com/styleguide/templates/2.0\n\n-->\n<html>\n <head>\n <meta http-equiv="Content-type" content="text/html; charset=utf-8">\n <title>Unicorn! · GitHub</title>\n