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

Fix None value in parameters #101

Closed nledez closed 3 years ago

nledez commented 3 years ago

This PR fix #99

rbeuque74 commented 3 years ago

Hello, Thanks for your contribution.

I looked at the code, and I think the fix is not the right one. Here, you will omit all parameters None from being sent to the API.

But, if I take your code example from the issue, and change it to POST method:

result = client.post('/domain/zone/hashicorp4noobs.fr/record', 
    fieldType=None, // Filter the value of fieldType property (like) (type: zone.NamedResolutionFieldTypeEnum)
    subDomain="foo", // Filter the value of subDomain property (like) (type: string)
)

We expect the body to be

{
    "fieldType": null,
    "subDomain": "foo"
}

With your patch, this behaviour will be broken.

I addressed the rest of your patch here: https://github.com/ovh/python-ovh/pull/102 Feel free to comment/review/approve it.

Thanks Romain

rbeuque74 commented 3 years ago

Feel free to reopen the pull-request if needed.