Persist parameters with auto_paging_iter()#222
Conversation
| response, api_key = requestor.request('get', url, params) | ||
| return convert_to_stripe_object(response, api_key, stripe_account) | ||
| stripe_object = convert_to_stripe_object(response, api_key, stripe_account) | ||
| stripe_object._retrieve_params = params |
There was a problem hiding this comment.
While I'm never a fan of assigning to "private" instance variables, I believe this is the best way to fix the current bug.
There was a problem hiding this comment.
Yeah, I was wondering about this one too.
Here's what PEP-8 has to say about the leading underscore:
_single_leading_underscore: weak "internal use" indicator. E.g. from M import * does not import objects whose name starts with an underscore.
In this case, _retrieve_params should be considered a property of StripeObject. Because ListObject (a descendant of StripeObject) already accesses it, we could consider its visibility to be currently "protected" (based on the definition from other OO languages). ListableAPIResource is also a descendant of StripeObject so we're not really modifying that visibility from what it was before.
The idea of protected visibility is also in-line with PEP-8's idea of internal use, so I think we're okay on this here.
4886224 to
bf5a5da
Compare
bf5a5da to
4c1ca48
Compare
|
@olivierbellone Thanks a lot for tackling this fix man! Also, you measurably improved the quality of those tests, so thank-you for taking a look at that too. Going to get this shipped! |
|
Released as 1.32.1. |
This PR fixes #221:
auto_paging_iter()should now persist parameters.r? @brandur
cc @stripe/api-libraries