https://2.python-requests.org/en/master/user/advanced/#id1
import requests
url = "http://www.cip.cc"
headers = {
'user-agent': 'curl Dalvik/2.1.0 (Linux; U; Android 8.1.0; Pixel Build/NMF26F)'
}
# proxies = {'http': 'http://localhost:1087', 'https': 'http://localhost:1087'}
proxies = {'http': 'socks5://localhost:1086', 'https': 'socks5://localhost:1086'}
session = requests.Session()
session.proxies = proxies
response = session.post(url, headers=headers)
print(response.text)
session底层使用同一tcp连接, 但如果加上代理就不一定了
【mac测试效果】加上http代理不会使用同一tcp连接,socks5代理会!
如何判断是否同一tcp连接,后续补充。