Open U188 opened 3 years ago
import requests
PROXY_POOL_URL = 'http://localhost:8080/random'
def get_proxy(): try:
response = requests.get(PROXY_POOL_URL)
#如果获取成功,返回获取的ip地址
if response.status_code == 200:
return response.text
except ConnectionError:
return None
get一个代理时 可以实现在池中随机获取一个代理的功能吗