mollie / mollie-api-python

Mollie API client for Python
http://www.mollie.com
BSD 2-Clause "Simplified" License
113 stars 55 forks source link

Occasional ReadTimeoutErrors since version 3.6.0 #343

Open sommejan opened 6 months ago

sommejan commented 6 months ago

We have an issue since we upgraded from 2.12.0 to 3.6.0. Sometimes we get the said error when receiving a mollie webhook and the error happens exactly when we try to fetch the related payment with client.payments.get(payment_id). We cannot find any similarities between the requests involved and it also happens at different times but not each time but each time at the same point I mentioned above. Our Python version was upgraded from 3.7 to 3.10.

RequestError: Unable to communicate with Mollie: HTTPSConnectionPool(host='api.mollie.com', port=443): Max retries exceeded with url: /v2/payments/tr_xxx (Caused by ReadTimeoutError("HTTPSConnectionPool(host='api.mollie.com', port=443): Read timed out. (read timeout=5)"))
  File "xyy", line 512, in fetch_payment
    return client.payments.get(payment_id)
  File "mollie/api/resources/payments.py", line 44, in get
    return super().get(resource_id, **params)
  File "mollie/api/resources/base.py", line 97, in get
    result = self.perform_api_call(self.REST_READ, path, params=params)
  File "mollie/api/resources/base.py", line 42, in perform_api_call
    resp = self.client.perform_http_call(http_method, path, data, params, idempotency_key)
  File "mollie/api/client.py", line 276, in perform_http_call
    return self._perform_http_call_apikey(
  File "mollie/api/client.py", line 227, in _perform_http_call_apikey
    raise RequestError(f"Unable to communicate with Mollie: {err}")

Originally posted by @sommejan in https://github.com/mollie/mollie-api-python/issues/339#issuecomment-1966666603