Shopify / shopify_python_api

ShopifyAPI library allows Python developers to programmatically access the admin section of stores
http://shopify.github.io/shopify_python_api
MIT License
1.28k stars 354 forks source link

next_page() doesn't return what it should return #552

Closed Raveninfly closed 2 years ago

Raveninfly commented 3 years ago

Issue summary

Variant.find().next_page() doesn't return product_id

def get_all_resources(res_type, **kwargs):
    logger.info('getting shopify resources')
    resources = []
    resources_temp = res_type.find(**kwargs) # fields='id,product_id'
    # resource_temp returned variants with attr {id, product_id}
    pause_sdk()

    resources.extend(resources_temp)

    while resources_temp.has_next_page():
        pause_sdk()
        resources_temp = resources_temp.next_page()
        # resource_temp have variants with attr {id}
        # it doesn't have product_id, but if I go to link of request I can see that it give {id, product_id}
        pause_sdk()

        resources.extend(resources_temp)

    logger.info('got {} resources'.format(len(resources)))

    return resources

Also, I've tried to get resources with page_url

resources_temp = shopify.Variant.find(fields='id,product_id')
next_url = resources_temp.next_page_url
resources_temp = res_type.find(from_=next_url)

the result is the same

Expected behavior

next_page returns particular fields that a mentioned in .find(**kwargs) # fields='id,product_id'

Actual behavior

next_page returns all but not the product_id if I request for fields='id,title,product_id' variable will have {id,title} so product_id returns only in first request with find

Steps to reproduce the problem

  1. resources_temp =shopify.Variant.find(fields='id,product_id')
  2. resources_temp = resources_temp.next_page()
github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days.

github-actions[bot] commented 2 years ago

We are closing this issue because it has been inactive for a few months. This probably means that it is not reproducible or it has been fixed in a newer version. If it’s an enhancement and hasn’t been taken on since it was submitted, then it seems other issues have taken priority.

If you still encounter this issue with the latest stable version, please reopen using the issue template. You can also contribute directly by submitting a pull request– see the CONTRIBUTING.md file for guidelines

Thank you!