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

Moved raw_request functions from stripe module to StripeClient class #1390

Open
wants to merge 7 commits into
base: beta
Choose a base branch
from

Conversation

jar-stripe
Copy link

@jar-stripe jar-stripe commented Sep 6, 2024

Context:
We are changing our SDKs to move "raw request" functions into the StripeClient class.

…nit__.py to StripeClient in _stripe_client.py

updated tests and README
stripe/_stripe_client.py Outdated Show resolved Hide resolved
tests/test_integration.py Outdated Show resolved Hide resolved
stripe/_preview.py Outdated Show resolved Hide resolved
stripe/_stripe_client.py Show resolved Hide resolved

from stripe._raw_request import raw_request as _raw_request # noqa
from stripe._raw_request import raw_request_async as _raw_request_async # noqa
from stripe._raw_request import deserialize as _deserialize # noqa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above 3 methods use the global api requestor. I believe one of the key differentiators of the StripeClient model is that there is a dedicated api requestor per StripeClient that gets used instead of the global one - that is how we get to set different api-key/account per StripeClient.

Therefore, I think we need a bigger refactor.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is done. I removed _raw_request.py and merged those methods directly into StripeClient so I could use its _requestor member, and updated the tests to match.

… to use its _requestor

updated test_raw_request to use stripe_client fixture
updated test_integration to use MOCK_API_KEY when creating StripeClient objects
comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants