Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python requests adds params to querystring, where it should be in the body for non-safe HTTP methods (POST/PATCH/DELETE/etc) #342

Closed
gabn88 opened this issue Feb 27, 2024 · 8 comments · Fixed by #355, #363 or #367

Comments

@gabn88
Copy link

gabn88 commented Feb 27, 2024

Specifications

  • API Version: 3.6.0

Describe the issue

See https://github.com/psf/requests/blob/eea3bbf9ac635f465ee6c9903dc57c677952dafd/src/requests/api.py#L19
the params kwargs goes into the query string, whereas the data goes into the body.

I think this is the issue why I get:

Non-existent query parameter "testmode" for this API call. Did you mean: "include"?

When setting testmode to True.

For your reference this is where it goes wrong in the code:

params["testmode"] = "true"

@fjbender fjbender transferred this issue from mollie/mollie-api-php Feb 27, 2024
@fjbender
Copy link
Contributor

Which type of authentication are you using towards the Mollie API?

@gabn88
Copy link
Author

gabn88 commented Mar 8, 2024

We use the 'setup_oauth' method (OAuth2Session authentication).

@geertjanvdenbosch
Copy link
Collaborator

Reopened because #361 will be reverted.

@gabn88
Copy link
Author

gabn88 commented Sep 23, 2024

@geertjanvdenbosch I now get error on 3.7.2, but it seems the latest fix is not yet on pypi?

Mollie API call failed: Invalid value for testmode field. Testmode should be boolean true or boolean false.

if you need more info I can also dive into it to get the request params, etc.

@geertjanvdenbosch
Copy link
Collaborator

Hi @gabn88,

How do you pass testmode?

@gabn88
Copy link
Author

gabn88 commented Sep 25, 2024

        mollie_client.set_testmode(True)

@geertjanvdenbosch
Copy link
Collaborator

Hi @gabn88,

All should be good now!

@gabn88
Copy link
Author

gabn88 commented Dec 10, 2024

@geertjanvdenbosch

Seems to work, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment