mirror of
https://github.com/ovh/python-ovh.git
synced 2026-01-16 23:00:21 +00:00
Merge pull request #10 from alkivi-sas/master
Added doc for passing parameters
This commit is contained in:
commit
4f76759540
2 changed files with 55 additions and 1 deletions
29
README.rst
29
README.rst
|
|
@ -186,7 +186,7 @@ is only supported with reserved keywords.
|
|||
# Create a new alias
|
||||
client.post('/email/domain/%s/redirection' % DOMAIN,
|
||||
_from=SOURCE,
|
||||
to=DESTINATION
|
||||
to=DESTINATION,
|
||||
localCopy=False
|
||||
)
|
||||
print "Installed new mail redirection from %s to %s" % (SOURCE, DESTINATION)
|
||||
|
|
@ -371,6 +371,33 @@ The client will successively attempt to locate this configuration file in
|
|||
This lookup mechanism makes it easy to overload credentials for a specific
|
||||
project or user.
|
||||
|
||||
Passing parameters
|
||||
=============
|
||||
|
||||
You can call all the methods of the API with the necessary arguments.
|
||||
|
||||
If an API needs an argument colliding with a Python reserved keyword, it
|
||||
can be prefixed with an underscore. For example, ``from`` argument of
|
||||
``POST /email/domain/{domain}/redirection`` may be replaced by ``_from``.
|
||||
|
||||
With characters invalid in python argument name like a dot, you can:
|
||||
|
||||
.. code:: python
|
||||
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
import ovh
|
||||
|
||||
params = {}
|
||||
params['date.from'] = '2014-01-01'
|
||||
params['date.to'] = '2015-01-01'
|
||||
|
||||
# create a client
|
||||
client = ovh.Client()
|
||||
|
||||
# pass parameters using **
|
||||
client.post('/me/bills', **params)
|
||||
|
||||
Hacking
|
||||
=======
|
||||
|
||||
|
|
|
|||
|
|
@ -363,6 +363,33 @@ The client will successively attempt to locate this configuration file in
|
|||
This lookup mechanism makes it easy to overload credentials for a specific
|
||||
project or user.
|
||||
|
||||
Passing parameters
|
||||
=============
|
||||
|
||||
You can call all the methods of the API with the necessary arguments.
|
||||
|
||||
If an API needs an argument colliding with a Python reserved keyword, it
|
||||
can be prefixed with an underscore. For example, ``from`` argument of
|
||||
``POST /email/domain/{domain}/redirection`` may be replaced by ``_from``.
|
||||
|
||||
With characters invalid in python argument name like a dot, you can:
|
||||
|
||||
.. code:: python
|
||||
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
import ovh
|
||||
|
||||
params = {}
|
||||
params['date.from'] = '2014-01-01'
|
||||
params['date.to'] = '2015-01-01'
|
||||
|
||||
# create a client
|
||||
client = ovh.Client()
|
||||
|
||||
# pass parameters using **
|
||||
client.post('/me/bills', **params)
|
||||
|
||||
Hacking
|
||||
=======
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue