Making HTTPS Requests in Twisted

I am trying to write a client that can execute both HTTP and HTTPS requests depending on how it is configured. For regular HTTP, I used twisted.web.client.Agent and used agent.request (METHOD, HOST, HEADERS, CONTENT) to execute the requests. I am interested in that this is the host field, when I do HTTP, it works by doing something like " http: // localhost: 8000 ", but if I switch to HTTPS, I get the error message:

Crash: twisted.web.error.SchemeNotSupported: Unsupported scheme: 'https'

I know about the existence of the client.getPage method, but I was wondering if there are any similar awesome and high level methods that I can do with queries, like with agent.request, but using HTTPS?

+3
source share
1 answer

HTTPS support is only recently added to twisted.web.client.Agent. If you can use Twisted 10.1, which was recently released, it Agentwill accept your HTTPS addresses.

+5
source

Source: https://habr.com/ru/post/1753722/


All Articles