-
-
Notifications
You must be signed in to change notification settings - Fork 476
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
Added DjStripeHTTPClient to handle all Stripe API calls. #1913
base: master
Are you sure you want to change the base?
Conversation
54f4276
to
3622742
Compare
3622742
to
2e0c7ec
Compare
2e0c7ec
to
69e7ddd
Compare
91d768a
to
67332d8
Compare
… Model This was done because one can create multiple independent update requests for the exact same Stripe object.
The _api_update() method now does the following: 1) Generates a new Idempotency Key object if not given one using the Stripe object's ID that is being updated. 2) Uses the Idempotency key (from 1)) to make the Stripe API call. 3) Updates the metadata of the Stripe object with the idempotency_key key if the Stripe object supports the metadata key.
This was done in order for the STRIPE_TEST_SECRET_KEY env var to be passed from tox to pytest.
This was done in order to get around RateLimit and other related errors.
This was done because tests would fail due to low coverage of tests using the api. This is a temp fix until more tests can be added.
382696b
to
2cca5c7
Compare
…nning tests This was done because in some errors Stripe may ask us not to retry.
2cca5c7
to
1e3c4d9
Compare
My two cents: I'm not fond of adding an additional layer of abstraction to the Stripe Python client. These are already features that exist in that client, and adding this layer of abstraction absolutely will introduce confusion, as well as increasing maintenance costs. Additionally, adding test flags is a code smell. If you need flags to test the code, then the code should be refactored to be more appropriately testable. If having default retries/rate limit handling is desired, a more appropriate approach would be to configure a central |
15e04c3
to
8727894
Compare
PR #1909 and PR #1910 need to be merged before this PR can be merged.
This PR adds support for
DjStripeHTTPClient
that provides out of the box the following capabilities:rate_limit
errorslock_timeout
errorsIdempotency
keys as the case may be.