简要步骤:
1.在windows上开启charles代理工具
2.在iPad上设置代理,安装charles证书,并且信任证书
更新requests 为支持socks的版本:
pip install -U requests[socks]
测试代码:
import requests
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36',
}
proxies = {
#'socks5': '127.0.0.1:8889'
'http':'socks5://127.0.0.1:8889',
'https':'socks5://127.0.0.1:8889'
}
url = 'http://nkm3s8.xyz/'
try:
print('Proxy:')
res = requests.get(url, headers=headers, proxies=proxies, timeout=10)
print(res)
except Exception as e:
print(e)
try:
print('No Proxy:')
res = requests.get(url, headers=headers, timeout=10)
print(res)
except Exception as e:
print(e)