Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 630 Bytes

adapter.rst

File metadata and controls

21 lines (14 loc) · 630 Bytes

Adapter Usage

Creating an Adapter

The standard requests means of using an adapter is to :py~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.

>>> 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.