raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='XXXX', port=443): Max retries exceeded with url: /lishi/ruyixiaolangjun (Caused by ProxyError('Cannot connect to proxy.', OSError(0, 'Error')))
解决方案为添加:
import os os.environ['NO_PROXY'] = 'XXXX.xx'
import requests
import os
import certifi
if __name__ == '__main__':
os.environ['NO_PROXY'] = '51shucheng.net'
target = 'https://www.51shucheng.net/lishi/ruyixiaolangjun'
req = requests.get(url=target)
req.encoding = "utf-8"
html = req.text