4

I'm using OVH API along with python wrapper:

https://pypi.python.org/pypi/ovh

When trying to execute this code:

import ovh

client = ovh.Client()

# Print nice welcome message
print "Welcome", client.get('/me')['firstname']

I get this error:

Traceback (most recent call last):
  File "index.py", line 6, in <module>
    print "Welcome", client.get('/me')['firstname']
  File "/home/rubinhozzz/.local/lib/python2.7/site-packages/ovh/client.py", line 290, in get
    return self.call('GET', _target, None, _need_auth)
  File "/home/rubinhozzz/.local/lib/python2.7/site-packages/ovh/client.py", line 419, in call
    raise BadParametersError(json_result.get('message'))
ovh.exceptions.BadParametersError: Invalid signature

My info is saved in the ovh.conf as the documentation suggests.

[default]
; general configuration: default endpoint
endpoint=ovh-eu

[ovh-eu]
application_key=XXXlVy5SE7dY7Gc5
application_secret=XXXdTEBKHweS5F0P0tb0lfOa8GoQPy4l
consumer_key=pscg79fXXX8ESMIXXX7dR9ckpDR7Pful

It looks that I can connect but when trying to use the services like for instance "/me", the error raises!

Ruben
  • 1,065
  • 5
  • 18
  • 44
  • Hi Ruben , was your problem solved ? Otherwise, feel free to open an issue on http://github.com/ovh/python-ovh or subscribe to api-subscribe@ml.ovh.net. It will be easier to help from there :) – yadutaf Jun 24 '16 at 09:35
  • @yadutaf somehow I was using a old version of OVH library. I could solve it. Thanks – Ruben Jul 06 '16 at 21:33

1 Answers1

2

It is difficult to reproduce the issue because it requires an application key and it seems that it is only granted to existing customers of OVH. I couldn't even see a link to an account registration page on their site.

By looking at the code of the call() method in /ovh/client.py, it seems that their server doesn't recognise the format or the content off the signature sent by your script. According to the inline documentation the signature is generated from these parameters:

  • application_secret
  • consumer_key
  • METHOD
  • full request url
  • body
  • server current time (takes time delta into account)

Since your call is identical to the example code provided on the OVH Python package web page, the last four parameters should be valid. In that case it looks like either the application secret or the customer key (or both) in your config file are not correct.

See also the documentation on OVH site under the 'Signing requests' heading. They explain how the signature is made and what it should look like.

Perhaps try to re-create a new application API to obtain new key and secret and make sure you copy them without any additional character.

user3748764
  • 346
  • 2
  • 11