Python api - adding tag to newly created contact

I’m using the official python library with python 2.7 and django.

I’m not sure if this is the best method but I want to add a tag onto every contact I create using my api. For example, when I create a contact using the api on my production server I want to tag it “production”. When on staging, tag it “staging”. etc.

The idea is to later fire off email sequences for every new contact with a “production” tag.

I could also fire off test email sequences for those with “staging” tags.

Following the example code for the lib I am adding contacts using:

contact = {‘Email’: ‘me@example.com’}
infusionsoft.ContactService(‘add’, contact)

I’m guessing there is a way to add a field for tags in the contact JSON?

I’m not sure how since the example doesn’t match the documentation body examples.

I tried adding “tag_ids”, “tags”…

It looks like the code you provided is for the XML/RPC API not the REST. I am not familiar with the Python SDK, but I don’t think it has been updated to handle the REST API yet. However the XML/RPC does allow you to tag a contact. xml-rpc - Keap Developer Portal

I would look for a call similar to this in the Python SDK.