jhao104 / proxy_pool

Python ProxyPool for web spider
https://jhao104.github.io/proxy_pool/
MIT License
21.38k stars 5.16k forks source link

https代理使用? #762

Open chenying99 opened 1 year ago

chenying99 commented 1 year ago

请问https代理是这么使用吗?

import requests

def get_proxy():
    return requests.get("http://127.0.0.1:5010/get/?type=https").json()  # 添加参数?type=https

def delete_proxy(proxy):
    requests.get("http://127.0.0.1:5010/delete/?proxy={}".format(proxy))

然后下面requests使用:

html = requests.get('http://www.example.com', proxies={"http": "http://{}".format(proxy)})

应该修改为?

html = requests.get('http://www.example.com', proxies={"https": "http://{}".format(proxy)})

还是两个http都要修改为https?

html = requests.get('http://www.example.com', proxies={"https": "https://{}".format(proxy)})
jhao104 commented 1 year ago

html = requests.get('http://www.example.com', proxies={"https": "https://{}".format(proxy), "http": "https://{}".format(proxy)})