Skip to content

Commit cba9754

Browse files
committed
Example code
1 parent 778e361 commit cba9754

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.rst

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,27 @@ Nirum HTTP transport for Python
33

44
This package provides an HTTP transport for nirum-python_.
55

6-
.. _nirum-python: https://github.com/spoqa/nirum-python
6+
.. code-block:: python
7+
8+
from youtservice import YourService_Client
9+
from nirum_http import HttpTransport
10+
11+
transport = HttpTransport('https://service-host/')
12+
client = YourService_Client(transport)
13+
14+
Since ``HttpTransport`` utilizes requests_ library under the hood, it can take
15+
a `session object`_ as well:
716

17+
.. code-block:: python
18+
19+
from requests import Session
20+
21+
session = Session()
22+
session.auth = ('user', 'password')
23+
transport = HttpTransport('https://service-host/', session=session)
24+
25+
.. _nirum-python: https://github.com/spoqa/nirum-python
26+
.. _requests: http://python-requests.org/
27+
.. _session object: http://docs.python-requests.org/en/master/user/advanced/#session-objects
828

929
.. include:: CHANGES.rst

0 commit comments

Comments
 (0)