我应该在代理上使用什么?插座,http.client,pycurl或其他任何东西?

发布于 2025-01-22 12:31:36 字数 484 浏览 0 评论 0原文

好的,基本上,我正在编写一件代码,这些代码在很大程度上取决于速度,

headers = {
            'Authorization': 'Bearer '+jtw,
        }
        conn = http.client.HTTPSConnection("api.minecraftservices.com")
        conn.request("PUT", "/minecraft/profile/name/"+user, headers=headers)
        response = conn.getresponse()
        status_code = response.status
        resp = response.read().decode("utf-8")

我尝试了http.client,但显然他们不支持代理人,我想要相似/相同的速度,它需要支持代理,我现在的问题现在是我的问题是..我应该使用什么?

Okay so basically, I'm writing a piece of code that heavily depends on speed,

headers = {
            'Authorization': 'Bearer '+jtw,
        }
        conn = http.client.HTTPSConnection("api.minecraftservices.com")
        conn.request("PUT", "/minecraft/profile/name/"+user, headers=headers)
        response = conn.getresponse()
        status_code = response.status
        resp = response.read().decode("utf-8")

I tried http.client, but apparently they don't support proxies, I want similar/same speed, and it needs to support proxies, my question now is.. what should I use?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

同展鸳鸯锦 2025-01-29 12:31:37

http.Client确实支持代理,请参见

https://docs.python.org/3/library/http.client.html#http.client.httpconnection.set_tunnel.set_tunnel

关注速度,通过等待HTTP请求时间,响应元件,因此curlsockethttp.client是无关紧要的,它们都具有相同的速度。

http.client does support proxies, see

https://docs.python.org/3/library/http.client.html#http.client.HTTPConnection.set_tunnel

Concerning speed, a proxied HTTP request time is dominated by waiting for network responsens, so the various different overheads in curl, Socket or http.client are irrelevant, they will all have the same speed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文