Import Tags from csv using Python

Quick example how to import tags from CSV file using Slamby Python SDK.

import slamby_sdk
from import ApiException
import csv

server = ""
secret = "s3cr3t"
targetDataset = "demo"

client = slamby_sdk.ApiClient(server)
client.set_default_header("Authorization", "Slamby {0}".format(secret))
client.set_default_header("X-DataSet", targetDataset);

with open('tags.csv') as csvfile: 
    for item in csv.DictReader(csvfile):
            tag = slamby_sdk.Tag()
   = item["Id"]
   = item["Name"]
            slamby_sdk.TagApi(client).create_tag(tag = tag)
        except ApiException as e:

Download this example from here

Leave a Reply

Your email address will not be published. Required fields are marked *