[Twisted-Python] Twisted HTTP client with certificate ?

Roland Hedberg roland.hedberg at adm.umu.se
Sun Mar 9 12:06:16 MDT 2008


Drew Smathers wrote:
> On Sun, Mar 9, 2008 at 11:10 AM, Roland Hedberg
> <roland.hedberg at adm.umu.se> wrote:
>> Hi!
>>
>>  It seems like the HTTP client in Twisted handles HTTPS and easily as
>>  HTTP connections.
>>
>>  But, I can not find any place where I can specify a client certificate
>>  to use in the HTTPS connection.
>>
>>  Is there something I have overlooked or is there another solution I can
>>   use, because I need to have certificates on both the server and the
>>  client side.
>>
>>  -- Roland
>>
> 
> You need to pass a ContextFactory which provides the client certificate:
> 
>   reactor.connectSSL(host, port, factory, contextFactory)
> 
> web.client.getPage, for example, takes a contextFactory as a keyword argument.

OK, that was simple :-)
Thanks !

-- Roland




More information about the Twisted-Python mailing list