requests如何不使用系统代理
1. 指定域名不使用代理
import os import requests os.environ['NO_PROXY'] = 'stackoverflow.com' response = requests.get('http://www.stackoverflow.com')
2. 设置代理为None
import requests proxies = { "http": None, "https": None, } requests.get("http://example.org", proxies=proxies)
3. 设置trust_env = False
import requests session = requests.Session() session.trust_env = False response = session.get('http://www.stackoverflow.com')