Shopify Python API - Article

New Member
2 0 0



I am having an issue with the Shopify python API, when trying to create an Article with tags. 


I have the following script:


for post in blog:
    new_article = shopify.Article()
    new_article.title = post[0].decode('windows-1252') = post[2].decode('windows-1252')
    new_article.blog_id = post[3].decode('windows-1252')
    new_article.body_html = post[4].decode('windows-1252')
    new_article.created_at = post[5].decode('windows-1252')
    new_article.handle = post[6].decode('windows-1252')
    new_article.image = post[7].decode('windows-1252')
    new_article.published = 'TRUE'
    new_article_tags = post[11]

    new_article.tags = new_article_tags
    new_article.published_at = post[9].decode('windows-1252')
    print new_article.errors.full_messages()

post[11] prints like this: 'Tag1, Tag2, Tag3'


I can run the script and get no errors, however when I check the articles that have been created, there are no tags on the products. 


Banging my head against the wall with this one and hoping that someone may be able to point me in the right direction. 

Shopify Partner
26 1 5

From the code in it looks like "tags" is not a field that you can set on Article instance. It's a classmethod, probably retrieves the tags of the article.


Looks like someone has had a similar issue with another resource in the past and the solution appears to be to pass a dictionary of all the fields to the initialiser:


In your case that would be:


new_article = shopify.Article({...., "tags": post[11]})