ShopifyResource.find does not propagate kwargs to PaginatedCollection
See original GitHub issueHey folks, I’m testing the new pagination and I’ve found that resource.find(no_iter_next=True)
doesn’t work as expected (e.g. the resulting iterator will still fetch additional pages).
After having a quick look through the source code, it appears that this is because the kwargs
are never passed through: https://github.com/Shopify/shopify_python_api/blob/master/shopify/base.py#L213
Overriding the variable on the collection works fine, but is non-ideal:
collection = resource.find(**kwargs)
collection._no_iter_next = True
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
python - Inheritance best practice : *args, **kwargs or explicitly ...
Update : In this case, having the *args can cause troubles if a new positional argument is added to the parent. I would...
Read more >How To Use *args and **kwargs in Python 3 - DigitalOcean
In this tutorial, we will cover the syntax of working with *args and **kwargs as parameters within functions to pass a variable number...
Read more >Python args and kwargs: Demystified
In this step-by-step tutorial, you'll learn how to use args and kwargs in Python to add ... If you try to execute this...
Read more >Super Inherit Your Python Class - E.Y. - Medium
Even if Sneaky class don't need to get anything from the inheritance (no args taken), it still need to do super in order...
Read more >Subclassing and Inheritance — PythonCert 5.0 documentation
In object-oriented programming (OOP), inheritance is a way to reuse the code of ... will get the new value, even if the methods...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s important that
no_iter_next
be the default behavior here, and only allow automatic iteration of subsequent pages if the caller has explicitly asked for that via a parameter. Otherwise, this isn’t backwards compatible and will likely introduce a lot of serious bugs and runaway code for people who are upgrading.As mentioned above, existing code that does implicit iteration via
for order in shopify.Order.find(limit=5):
is expecting to iterate over at most 5 orders, but with the new behavior this will iterate over all orders in the entire shop.This will likely break almost every Python client so it’s important to invert the default behavior.
Okay, I have changed my Pr to make no_iter_next to default to True. I will release this tonight so that you can use this and it will be easier to use. I will be a breaking release in case anyone has built on top of the current behaviour