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

stripe-python v8 release #1206

Merged
merged 7 commits into from
Jan 25, 2024
Merged

stripe-python v8 release #1206

merged 7 commits into from
Jan 25, 2024

Conversation

anniel-stripe
Copy link
Contributor

@anniel-stripe anniel-stripe commented Jan 24, 2024

Changelog

This release introduces StripeClient and a service-based call pattern. This new interface allows you to easily call Stripe APIs and has several benefits over the existing resource-based pattern:

  • No global config: you can simultaneously use multiple clients with different configuration options (such as API keys)
  • No static methods for easier mocking

For full migration instructions, please refer to the v8 migration guide.

"⚠️" symbol highlights breaking changes

⚠️ Changed

  • ⚠️ Request options like api_key, stripe_account, stripe_version, and idempotency_key can no longer be passed in positionally on resource methods. Please pass these in as keyword arguments.

BEFORE

stripe.Customer.create(
  "sk_test_123",  # api key
  "KG5LxwFBepaKHyUD",  # idempotency key
  "2022-11-15",  # stripe version
  "acct_123",  # stripe account
)

AFTER

stripe.Customer.create(
  api_key="sk_test_123",
  idempotency_key="KG5LxwFBepaKHyUD",
  stripe_version="2022-11-15",
  stripe_account="acct_123",
)
  • ⚠️ Methods that turn a response stream (Quote.pdf) now returns a single value of type StripeResponseStream instead of a tuple containing (StripeResponseStream, api_key).
  • ⚠️ Removed public access to APIRequestor. APIRequestor's main use is internal, and we don't have a good understanding of its external use cases. We had to make several breaking changes to its interface as part of this update, so rather than leaving it public we made it private. If you have a use case for APIRequestor, please open up a Github issue describing it. We'd rather you rely on something specifically designed for your use case than having to reach into the library's internals.

⚠️ Removed

  • ⚠️ Remove api_version from File.create parameters. Please use stripe_version instead.
  • ⚠️ Remove util.read_special_variable() utility method (importing directly from stripe.util is deprecated as of v7.8.0)
  • ⚠️ Remove StripeError.construct_error_object(). This method was intended for internal stripe-python use only.
  • ⚠️ Remove ListObject.empty_list(). This method was intended for internal stripe-python use only.
  • ⚠️ Remove SearchResultObject.empty_search_result(). This method was intended for internal stripe-python use only.
  • ⚠️ Remove StripeObject.ReprJSONEncoder. This class was intended for internal stripe-python use only.
  • ⚠️ Remove StripeObject.api_base. This property was defunct and returned None.

* Generated files

* Non-generated files

* Tests

* Inline one-off methods

* _ prefix for private APIRequestor methods and attributes, remove extra _Proxy

* Handle None options and tests fixes

* Don't accept api_mode in methods that don't use it

* Allow setting api_key, stripe_version, and stripe_account on StripeObject (#1201)

* Allow setting api_key, stripe_version, and stripe_account on StripeObject

* refactor

* fmt

* Don't mutate APIRequestor

* Update README with StripeClient examples (#1202)

* Update README with StripeClient examples

* from stripe import StripeClient

* fix test

* fix test

* Move _default_proxy to APIRequestor

* Don't copy twice, rtype params with Unpack[RequestOptions]

* More feedback

* Test service exports
* Remove StripeObject.request

* Change to deprecated
* Remove some deprecated methods

* Add back ListObject and SearchResultObect request sending methods
* Un-deprecate ListObject methods

* lint
* Remove APIRequestor from public API

* fmt

* lint
@anniel-stripe anniel-stripe merged commit c3384a5 into master Jan 25, 2024
29 checks passed
@ramya-stripe ramya-stripe deleted the sdk-release/next-major branch March 15, 2024 22:55
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.

None yet

2 participants