Skip to content

Commit 3282829

Browse files
Jean-Tiare Le Bigotyadutaf
authored andcommitted
add advanced usage documentation
Signed-off-by: Jean-Tiare Le Bigot <[email protected]>
1 parent bd15b2d commit 3282829

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

README.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,34 @@ With characters invalid in python argument name like a dot, you can:
453453
# pass parameters using **
454454
client.post('/me/bills', **params)
455455
456+
Advanced usage
457+
==============
458+
459+
Un-authenticated calls
460+
----------------------
461+
462+
If the user has not authenticated yet (ie, there is no valid Consumer Key), you
463+
may force ``python-ovh`` to issue the call by passing ``_need_auth=True`` to
464+
the high level ``get()``, ``post()``, ``put()`` and ``delete()`` helpers or
465+
``need_auth=True`` to the low level method ``Client.call()`` and
466+
``Client.raw_call()``.
467+
468+
This is needed when calling ``POST /auth/credential`` and ``GET /auth/time``
469+
which are used internally for authentication and can optionally be done for
470+
most of the ``/order`` calls.
471+
472+
Access the raw requests response objects
473+
----------------------------------------
474+
475+
The high level ``get()``, ``post()``, ``put()`` and ``delete()`` helpers as well
476+
as the lower level ``call()`` will returned a parsed json response or raise in
477+
case of error.
478+
479+
In some rare scenario, advanced setups, you may need to perform customer
480+
processing on the raw request response. It may be accessed via ``raw_call()``.
481+
This is the lowest level call in ``python-ovh``. See the source for more
482+
informations.
483+
456484
Hacking
457485
=======
458486

docs/index.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,34 @@ With characters invalid in python argument name like a dot, you can:
352352
# pass parameters using **
353353
client.post('/me/bills', **params)
354354
355+
Advanced usage
356+
==============
357+
358+
Un-authenticated calls
359+
----------------------
360+
361+
If the user has not authenticated yet (ie, there is no valid Consumer Key), you
362+
may force ``python-ovh`` to issue the call by passing ``_need_auth=True`` to
363+
the high level ``get()``, ``post()``, ``put()`` and ``delete()`` helpers or
364+
``need_auth=True`` to the low level method ``Client.call()`` and
365+
``Client.raw_call()``.
366+
367+
This is needed when calling ``POST /auth/credential`` and ``GET /auth/time``
368+
which are used internally for authentication and can optionally be done for
369+
most of the ``/order`` calls.
370+
371+
Access the raw requests response objects
372+
----------------------------------------
373+
374+
The high level ``get()``, ``post()``, ``put()`` and ``delete()`` helpers as well
375+
as the lower level ``call()`` will returned a parsed json response or raise in
376+
case of error.
377+
378+
In some rare scenario, advanced setups, you may need to perform customer
379+
processing on the raw request response. It may be accessed via ``raw_call()``.
380+
This is the lowest level call in ``python-ovh``. See the source for more
381+
informations.
382+
355383
Hacking
356384
=======
357385

ovh/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ def raw_call(self, method, path, data=None, need_auth=True):
454454
"""
455455
Lowest level call helper. If ``consumer_key`` is not ``None``, inject
456456
authentication headers and sign the request.
457-
Will return a vendored ``requests.Response`` object or let any ``requests`` exception pass through.
457+
Will return a vendored ``requests.Response`` object or let any
458+
``requests`` exception pass through.
458459
459460
Request signature is a sha1 hash on following fields, joined by '+'
460461
- application_secret

0 commit comments

Comments
 (0)