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

Error ovh #121

Closed AhrimanSefid closed 1 year ago

AhrimanSefid commented 1 year ago

Hi. plz help fixed.

Traceback (most recent call last): File "C:\Users\1\Desktop\2.py", line 18, in result = client.post("/auth/credential", ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\ovh\client.py", line 385, in post return self.call("POST", _target, kwargs, _need_auth) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\ovh\client.py", line 465, in call raise BadParametersError(json_result.get("message"), response=result) ovh.exceptions.BadParametersError: Body parameter accessRules isn't formated correctly OVH-Query-ID: EU.ext-2.64415cf2.40437.b4d78937-363f-44a4-aa8c-ba3793266eec

deathiop commented 1 year ago

Hi there,

Can you please give us some data? What version of the wrapper are you using? Can you show us some code?

AhrimanSefid commented 1 year ago

windows 10 x64 python 11

import ovh

create a client

client = ovh.Client()

copy file ovh.conf to C:\Python311\Lib\site-packages\ovh\

Grab bill list

bills = client.get('/me/bill') for bill in bills: details = client.get('/me/bill/%s' % bill) print("%12s (%s): %10s --> %s" % ( bill, details['date'], details['priceWithTax']['text'], details['pdfUrl'], ))

AhrimanSefid commented 1 year ago

Traceback (most recent call last): File "C:\Python311\Lib\site-packages\ovh\client.py", line 160, in init self._endpoint = ENDPOINTS[endpoint]


KeyError: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\1\Desktop\2.py", line 3, in <module>
    client = ovh.Client()
             ^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\ovh\client.py", line 162, in __init__
    raise InvalidRegion("Unknown endpoint %s. Valid endpoints: %s", endpoint, ENDPOINTS.keys())
ovh.exceptions.InvalidRegion: ('Unknown endpoint %s. Valid endpoints: %s', None, dict_keys(['ovh-eu', 'ovh-us', 'ovh-ca', 'kimsufi-eu', 'kimsufi-ca', 'soyoustart-eu', 'soyoustart-ca']))
AhrimanSefid commented 1 year ago

OK fixed. client = ovh.Client(config_file='C:/Python311/Lib/site-packages/ovh/ovh.conf')

AhrimanSefid commented 1 year ago

Why Error :

import json import ovh

client = ovh.Client(config_file='C:/Python311/Lib/site-packages/ovh/ovh.conf')

result = client.get('/allDom/{serviceName}')

Pretty print

print json.dumps(result, indent=4)

AhrimanSefid commented 1 year ago

File "C:\Users\1\Desktop\2.py", line 9 print json.dumps(result, indent=4) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

deathiop commented 1 year ago

Hi,

You'll find a lot of resources on the Internet regarding this kind of error. Here is one: https://stackoverflow.com/a/32124420. I'll close this ticket, as there is no issue to raise with python-ovh itself.