What should I use with proxies? Sockets, http.client, pycurl, or anything else?

140 views Asked by At

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?

1

There are 1 answers

2
Antonio Ragagnin On

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.