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

Methode POST sans body #95

Closed pierregeekme closed 2 years ago

pierregeekme commented 3 years ago

Bonjour,

Avec les nouvelles API que vous proposez (par exemple /cloud/project/{serviceName}/user/{userId}/s3Credentials), il n'y a pas de body à envoyer.

Cependant, la méthode post envoie tout le temps un body dans la requête. Cela provoque l'erreur suivante :

  File ".local/lib/python3.8/site-packages/ovh/client.py", line 377, in post
    return self.call('POST', _target, kwargs, _need_auth)
  File ".local/lib/python3.8/site-packages/ovh/client.py", line 448, in call
    raise BadParametersError(json_result.get('message'),
ovh.exceptions.BadParametersError: You provided an input body while none was expected

Si je crée une méthode (pour le test) postnobody(), cela fonctionne :

def postnobody(self, _target, _need_auth=True):
        return self.call('POST', _target, None, _need_auth)

Peut être est il possible de ne pas envoyer de body via la méthode post actuelle, mais dans ce cas, je n'ai pas trouvé comment faire.

Je vous remercie par avance pour la prise en compte de ce retour.

Cordialement,

ccottam commented 3 years ago

I ended up using

client.call('POST', '/cloud/project/{serviceName}/user/{userID}/s3Credentials')
bertrand-benoit commented 2 years ago

We have the same issue with /cloud/project/{service_name}/ai/job/{job_id}/kill entrypoint.

Will a new version will be released ?

woody3549 commented 2 years ago

Hello,

Got the same issue with /cloud/project/{service_name}/instance/{instance_id}/shelve or unshelve. Do you know when the new version will be released, please ?

For now, I am using the same workaround as @ccottam suggested.

Thanks. Regards

rbeuque74 commented 2 years ago

Hello, Sorry for the delay, This issue will be fixed in v1.0.0.

rbeuque74 commented 2 years ago

Fixed with #85. Released in https://github.com/ovh/python-ovh/releases/tag/v1.0.0

bertrand-benoit commented 2 years ago

Thanks, it is good! The operation is a success, and there is no more issue; nevertheless the response is None (thus, no status code, or anything) which is surprising.

pierregeekme commented 2 years ago

Thank you.