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)

 

posted @ 2020-07-17 16:30  逆欢  阅读(1147)  评论(0编辑  收藏  举报