Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save usaturn/2582091 to your computer and use it in GitHub Desktop.
Save usaturn/2582091 to your computer and use it in GitHub Desktop.
httplib,proxy,https
# 参考URL: http://d.hatena.ne.jp/gmaxlab/20090329/1238329567
import httplib, ssl
#HTTPで上手くいく場合
http_session = httplib.HTTPConnection("squidのドメイン", 8080)
http_session.request("GET", "http://yahoo.co.jp/")
r1 = http_session.getresponse()
print r1.status, r1.reason
#HTTPSで失敗する場合
https_session = httplib.HTTPSConnection("squidのドメイン", 8080) #HTTPSConnection を使用
https_session.request("GET", "http://yahoo.co.jp/") #この時点でプロンプトが返らない
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment