V2Ray采用sock5协议,requests要采用sock5需要单独安装依赖:

pip install requests[socks]

代码:

proxies = {
            "http": "socks5h://localhost:10808",
            "https": "socks5h://localhost:10808",
        }
requests.get(url,proxies=proxies)