Open lmscloud-io opened 1 month ago
Hi @lmscloud-io, Thank you for reporting this issue.
I am sorry that are facing this problem. We will look into this issue and get back to you with an update.
Thank you.
Here is even an easier way to reproduce it
operation = CreateAddress(country_code='US', postal_code='1')
paddle.addresses.create(customer_id, operation)
error message:
Request failed: 400 Client Error: Bad Request for url: https://sandbox-api.paddle.com/customers/ctm_01hzmk2j4rkdfea9qs28w4d10q/addresses
payload = FiltersUndefined.filter_undefined_values(operation.get_parameters())
url = paddle.transactions.client.options.environment.base_url + f"/customers/{customer_id}/addresses"
res = paddle.transactions.client.client.request("POST", url, json=payload)
you get a MEANINGFUL response:
{"error":{"type":"request_error","code":"bad_request","detail":"Invalid requ
est","documentation_url":"https://developer.paddle.com/v1/errors/shared/bad_
request","errors":[{"field":"postal_code","message":"US postal_code must be
5 digits only"}]},"meta":{"request_id":"7117f662-7acb-44d1-8e5a-922e86f33723
"}}
Hi @lmscloud-io
We have released a fix in 0.1.3
https://github.com/PaddleHQ/paddle-python-sdk/pull/11 to raise an ApiError
that provides more details with the following properties:
error_type
error_code
detail
docs_url
field_errors
(list)
field
error
Please note that the string representation of this error will be the detail string, e.g. Invalid request
. To get a full representation of the error, you can use repr(e)
.
Describe the bug
I created a customer with an address in Spain and did not specify the region in the address.
Then I sent a request:
It fails with an extremely uninformative error 400 Client Error: Bad Request for url: https://sandbox-api.paddle.com/transactions
If I send a request directly:
I get a response
Needless to say that I just wasted several days trying to figure out what was wrong before I tried to send a request directly to paddle. Extremely disappointed :(
Steps to reproduce
see above
Expected behavior
I would like to see what actually went wrong in the exception message
Code snippets
No response
Python version
3.11
SDK version
1.0.1
API version
1
Additional context
No response