ovh / python-ovh

Thin wrapper around OVH's APIs. Handles all the hard work including credential creation and requests signing.
https://pypi.org/project/ovh/
Other
278 stars 76 forks source link

how to call /me/bill with date range ? #76

Closed nchauvat closed 5 years ago

nchauvat commented 5 years ago

Hi,

https://api.ovh.com/console/#/me/bill#GET says options are date.from date.to and orderId.

The example states:

result = client.get('/me/bill', date.from='2019-01-01', // Filter the value of date property (>=) (type: datetime) date.to=None, // Filter the value of date property (<=) (type: datetime) orderId=None, // Filter the value of orderId property (=) (type: long) )

how is this supposed to work in python since the keyword arguments cannot be named with a dot in the middle ?

I tried date, datefrom, _from, etc. but did not get it to work. Reading the source and the canonicalize method did not help me either.

I look forward to the correct syntax. Thank you.

rbeuque74 commented 5 years ago

Hello, I suggest you use:

params = {'date.from': '2019-01-01', 'date.to': None, 'orderId': None}
result = client.get('/me/bill', **params)

The example generator on API Console is kind of broken for those kind of tricky part, we will have a look to fix it. Thanks Romain