requests-mock/docs/adapter.rst
Jamie Lennox aeb66e9046 Update docs
Update the docs to reference new features and the more recent way that
statements are written.

Change-Id: I7fc00143b9ab4366a00324aaf59d59baecf9da4a
2015-01-19 14:14:28 +10:00

22 lines
630 B
ReStructuredText

=============
Adapter Usage
=============
Creating an Adapter
===================
The standard `requests`_ means of using an adapter is to :py:meth:`~requests.Session.mount` it on a created session. This is not the only way to load the adapter, however the same interactions will be used.
.. doctest::
>>> import requests
>>> import requests_mock
>>> session = requests.Session()
>>> adapter = requests_mock.Adapter()
>>> session.mount('mock', adapter)
At this point any requests made by the session to a URI starting with `mock://` will be sent to our adapter.
.. _requests: http://python-requests.org