From 24bb4ba3183d83ffaac9e821df4f635f1348b0e7 Mon Sep 17 00:00:00 2001 From: Alkivi Date: Tue, 16 Jun 2015 12:48:09 +0200 Subject: [PATCH] added doc for parameters Signed-off-by: Alkivi --- README.rst | 29 ++++++++++++++++++++++++++++- docs/index.rst | 27 +++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 0786ba3..fb2230c 100644 --- a/README.rst +++ b/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 ======= diff --git a/docs/index.rst b/docs/index.rst index 8cc6a8c..1817026 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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 =======