requests
惠來ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為成都創(chuàng)新互聯(lián)公司的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:13518219792(備注:SSL證書合作)期待與您的合作!
#! -*- encoding:utf-8 -*- import requests import random # 要訪問的目標頁面 targetUrl = "http://httpbin.org/ip" # 要訪問的目標HTTPS頁面 # targetUrl = "https://httpbin.org/ip" # 代理服務(wù)器 proxyHost = "t.16yun.cn" proxyPort = "31111" # 代理隧道驗證信息 proxyUser = "username" proxyPass = "password" proxyMeta = "http://%(user)s:%(pass)s@%(host)s:%(port)s" % { "host" : proxyHost, "port" : proxyPort, "user" : proxyUser, "pass" : proxyPass, } # 設(shè)置 http和https訪問都是用HTTP代理 proxies = { "http" : proxyMeta, "https" : proxyMeta, } # 設(shè)置IP切換頭 tunnel = random.randint(1,10000) headers = {"Proxy-Tunnel": str(tunnel)} resp = requests.get(targetUrl, proxies=proxies, headers=headers) print resp.status_code print resp.text