您好,登錄后才能下訂單哦!
requests
#! -*- encoding:utf-8 -*- import requests import random # 要訪問的目標頁面 targetUrl = "http://httpbin.org/ip" # 要訪問的目標HTTPS頁面 # targetUrl = "https://httpbin.org/ip" # 代理服務器 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, } # 設置 http和https訪問都是用HTTP代理 proxies = { "http" : proxyMeta, "https" : proxyMeta, } # 設置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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。