开发者

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 H开发者_如何学CTTP, 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜