首页 > 解决方案 > 为什么我的 HTTP 代理没有连接到 HTTPS 网站?

问题描述

我试图了解为什么代理没有连接到网站,而是显示我的 IP

import httpx
import asyncio

proxies = {"http": "http://34.91.135.38:80"}
async def main():
    async with httpx.AsyncClient(proxies=proxies) as client:
        s = await client.get('https://api.ipify.org')
        print(s.text)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

当我尝试这样做时,它将显示我的 IP,而不是我选择的 IP。我希望能够使用我的代理连接到网站

标签: python-3.xpython-asynciohttpx

解决方案


推荐阅读