shopify 标题而不是产品 ID。 API Python
shopify Title instead of product id. API Python
我想在我的 shopify 商店中找到所有商品。我找到了这段代码,它给了我产品 ID。
xxx = shopify.Product.find(limit=50, page=1)
我要找的是标题.........
我试过了
xxx = shopify.Product.title(limit=50, page=1)
xxx = shopify.Product.title(limit=50, page=1).title()
xxx = shopify.title(limit=50, page=1)
xxx = title(limit=50, page=1)
我想在输出中看到什么 window。
'This is the title of the product' <- this is what I want to extract
我现在得到的是
product(322940174383) <- bad I want the title not product id
我编辑了我的答案,因为我误解了你的问题。
您必须遍历整个产品列表,您可以这样做:
p_count = shopify.Product.count()
p_max_pages = int(p_count / 250) + 1
titles = []
for page in range(1, p_max_pages + 1):
products = shopify.Product.find(page=page, limit=250)
for product in products:
titles.append(product.title)
在产品 object 循环中你可以找到 Shopify Documentation
中列出的所有属性
旧答案
如果您想按标题获取产品,您应该使用
shopify.Product.find(title="My Product")
此 returns 包含字符串 "My Product"
的产品列表
我想在我的 shopify 商店中找到所有商品。我找到了这段代码,它给了我产品 ID。
xxx = shopify.Product.find(limit=50, page=1)
我要找的是标题.........
我试过了
xxx = shopify.Product.title(limit=50, page=1)
xxx = shopify.Product.title(limit=50, page=1).title()
xxx = shopify.title(limit=50, page=1)
xxx = title(limit=50, page=1)
我想在输出中看到什么 window。
'This is the title of the product' <- this is what I want to extract
我现在得到的是
product(322940174383) <- bad I want the title not product id
我编辑了我的答案,因为我误解了你的问题。 您必须遍历整个产品列表,您可以这样做:
p_count = shopify.Product.count()
p_max_pages = int(p_count / 250) + 1
titles = []
for page in range(1, p_max_pages + 1):
products = shopify.Product.find(page=page, limit=250)
for product in products:
titles.append(product.title)
在产品 object 循环中你可以找到 Shopify Documentation
中列出的所有属性旧答案
如果您想按标题获取产品,您应该使用
shopify.Product.find(title="My Product")
此 returns 包含字符串 "My Product"
的产品列表