Python Proxy代理

import requests

proxy='36.56.206.127:20945'  #本地代理
#proxy='username:password@123.58.10.36:8080'
proxies={
    'http':'http://'+proxy,
    'https':'https://'+proxy
}
try:
    response=requests.get('https://',proxies=proxies)
    print(response.text)
except requests.exceptions.ConnectionError as e:
    print('错误:',e.args)
原文地址:https://www.cnblogs.com/zhangqing979797/p/13330876.html