Python Shopify API を使用して新しい商品を追加しようとしています。タイトルと本文と写真を追加する方法は知っていますが、価格を追加する際に問題があり、'requires_shipping': False が必要です。これを達成する方法がどこにも見つかりません。
これは私がこれまでに持っているものです。
import shopify
API_KEY = 'dsfsdsdsdsdsad'
PASSWORD = 'sadsdasdasdas'
shop_url = "https://%s:%s@teststore.myshopify.com/admin" % (API_KEY, PASSWORD)
shopify.ShopifyResource.set_site(shop_url)
path = "audi.jpg"
new_product = shopify.Product()
new_product.title = "Audi pictures test "
new_product.body_html = "body of the page <br/><br/> test <br/> test"
###########this part is so far good. but the bottom part is not working####
variant = shopify.Variant(price=9.99)) # this does not work
new_product.variant() # this does not work
variant_2 = shopify.Variant(requires_shipping=False) #this does not work
new_product.variant_2() This does not work
image = shopify.Image()
with open(path, "rb") as f:
filename = path.split("/")[-1:][0]
encoded = f.read()
image.attach_image(encoded, filename=filename)
new_product.images = [image] # Here's the change
new_product.save()