Skip to content

Commit

Permalink
Document Connector's verify_ssl and ssl_context parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Dec 29, 2014
1 parent de528d0 commit 7b95cab
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,32 @@ Most widly used is :class:`aiohttp.connector.TCPConnector`::
>>> r = yield from aiohttp.request('get', 'http://python.org', connector=conn)


SSL control for tcp sockets
---------------------------

:class:`aiohttp.connector.TCPConnector` constructor accepts mutually
exclusive *verify_ssl* and *ssl_context* params.

By default it uses strict checks for HTTPS protocol. Certification
checks can be relaxed by passing ``verify_ssl=False``::

>>> conn = aiohttp.TCPConnector(verify_ssl=False)
>>> r = yield from aiohttp.request('get',
... 'https://example.com', connector=conn)


If you need to setup custom ssl parameters (use own certification
files for example) you can create :class:`ssl.SSLContext` instance and
pass it into connector::

>>> sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
>>> context.verify_mode = ssl.CERT_REQUIRED
>>> context.load_verify_locations("/etc/ssl/certs/ca-bundle.crt")
>>> conn = aiohttp.TCPConnector(verify_ssl=False)
>>> r = yield from aiohttp.request('get',
... 'https://example.com', connector=conn)


Unix domain sockets
-------------------

Expand Down

0 comments on commit 7b95cab

Please sign in to comment.