I am using the Python API to create a Product with 5 Variants. I have been successful in creating the product in the store, without issue. The problem I have is once the product is created, I do not receive a response from Shopify. Because of this, I receive an HttpException from the API in my server.
I can deal with this, but I need to be able to create the product and populate a form with the Variant IDs of the newly created product. I was attempting this via an Ajax call to initiate the server call to Shopify, but I have also tried a synchronous request to the server, and I still do not receive a response from Shopify.
The Product details are as follows:
custom_product = shopify.Product()
custom_product.product_type = 'Custom Shirt'
custom_product.body_html = '<strong>Custom Shirt</strong>'
custom_product.title = 'Custom Shirt'
variant1 = shopify.Variant(dict(price=0, option1='Small'))
variant2 = shopify.Variant(dict(price=0, option1='Medium'))
variant3 = shopify.Variant(dict(price=0, option1='Large'))
variant4 = shopify.Variant(dict(price=0, option1='Extra Large'))
variant5 = shopify.Variant(dict(price=0, option1='2XL'))
variant6 = shopify.Variant(dict(price=price, option1='Bundle'))
custom_product.variants = [variant1,variant2,variant3,variant4,variant5, variant6]
# create images for front and back
front_image = shopify.Image(attributes=dict(shot='front'))
front_id = front_shirt_model.key().id()
front_image.src = 'http://myurl.com/img/'+str(front_id)
back_image = shopify.Image(attributes=dict(shot='back'))
back_id = back_shirt_model.key().id()
back_image.src = 'http://myurl.com/img/'+str(back_id)
custom_product.images = [front_image, back_image]
success = custom_product.save()
I should also mention that I am using Django on Google App Engine. I have tried different alternatives such as using the requests Python library to create the request JSON objects and connections, among others. Please let me know if there is something I have overlooked. Thank you in advance for any help.