Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making HTTPS Requests in Twisted

I am trying to write a client that can make both HTTP and HTTPS requests depending on how it is configured. For normal HTTP, I have been using twisted.web.client.Agent and using agent.request(METHOD, HOST, HEADERS, CONTENT) to make the requests. What I care about is that host field, when I do HTTP it works doing something like "http://localhost:8000", but if I switch to HTTPS, I get an error:

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

I am aware of the existence of the client.getPage method, but I was wondering if there was any similarly awesome and high level methods that I can make requests with just like agent.request, but using HTTPS?

like image 813
themaestro Avatar asked Aug 22 '26 21:08

themaestro


1 Answers

HTTPS support was only recently added to twisted.web.client.Agent. If you can use Twisted 10.1, very recently released, then Agent will accept your HTTPS URLs.

like image 128
Jean-Paul Calderone Avatar answered Aug 25 '26 11:08

Jean-Paul Calderone



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!