我应该在代理上使用什么?插座,http.client,pycurl或其他任何东西?
好的,基本上,我正在编写一件代码,这些代码在很大程度上取决于速度,
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http.Client
确实支持代理,请参见https://docs.python.org/3/library/http.client.html#http.client.httpconnection.set_tunnel.set_tunnel
关注速度,通过等待HTTP请求时间,响应元件,因此
curl
,socket
或http.client
是无关紧要的,它们都具有相同的速度。http.client
does support proxies, seehttps://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
orhttp.client
are irrelevant, they will all have the same speed.