themaestro
themaestro

Reputation: 14256

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?

Upvotes: 3

Views: 1330

Answers (1)

Jean-Paul Calderone
Jean-Paul Calderone

Reputation: 48335

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.

Upvotes: 5

Related Questions