Development discussions around Shopify APIs
Hello,
Our team has been notified that our app will stop working on April 1, 2021 because we'd be calling an unsupported API. We found the problem to be that we needed to update our app to use cursor-based relative pagination. Some background: our team is very bare bones and has been decimated by Covid. I am a novice programmer but have had issues troubleshooting our code.
Here is the code that worked and that we used prior to needing to make this change:
def get_all_resources(resource, **kwargs):
resource_count = resource.count(**kwargs)
print("site members: [{}]".format(resource_count))
resources = []
if resource_count > 0:
totalPages = ((resource_count - 1) // 250) + 2
for page in range(1, totalPages):
print("reading results page [{}]/[{}]".format(page, totalPages))
kwargs.update({"limit": 250, "page": page})
resources.extend(resource.find(**kwargs))
return resources
Here is the code that we are attempting to use that is not working for us:
def get_all_resources(resource, **kwargs):
resource_count = resource.count(**kwargs)
resources = []
if resource_count > 0:
page=resource.find(**kwargs)
resources.extend(page)
while page.has_next_page():
page = page.next_page()
resources.extend(page)
return resources
As I mentioned, I'm a pretty novice programmer, especially in Python, and it is solely up to me to solve this prior to April 1. Any help here would be incredibly appreciated! Thank you!
User | RANK |
---|---|
10 | |
5 | |
3 | |
3 | |
3 |
Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023Summary of EventsBeginning in January of 2023, some merchants reported seeing a large amo...
By Trevor May 15, 2023With 2-Factor Authentication being required to use Shopify Payments, we’re here to help yo...
By Imogen Apr 26, 2023