gocardless / gocardless-pro-python

GoCardless Pro Python Client
MIT License
37 stars 26 forks source link

JSONDecodeError when removing a customer #96

Open fuzzylogic2000 opened 5 months ago

fuzzylogic2000 commented 5 months ago

gocardless-pro==1.49.0

When I delete a customer, the delete works, but the return fails.

Traceback (most recent call last):
  File ".../lib/python3.10/site-packages/requests/models.py", line 974, in json
    return complexjson.loads(self.text, **kwargs)
  File ".../lib/python3.10/site-packages/simplejson/__init__.py", line 514, in loads
    return _default_decoder.decode(s)
  File ".../lib/python3.10/site-packages/simplejson/decoder.py", line 386, in decode
    obj, end = self.raw_decode(s)
  File ".../lib/python3.10/site-packages/simplejson/decoder.py", line 416, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".../vendors_api.py", line 129, in <module>
    client.customers.remove(identity=bank_account.links.customer)
  File ".../lib/python3.10/site-packages/gocardless_pro/services/customers_service.py", line 149, in remove
    return self._resource_for(response)
  File ".../lib/python3.10/site-packages/gocardless_pro/services/base_service.py", line 68, in _resource_for
    data = api_response.body[self._envelope_key()]
  File ".../lib/python3.10/site-packages/gocardless_pro/api_response.py", line 24, in body
    return self._response.json()
  File ".../lib/python3.10/site-packages/requests/models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I checked the response I get in customers_service.py line 147 and that looks fine: status_code=204 and empty content as the docs state it should look like.