Skip to content

Instantly share code, notes, and snippets.

@brianboyer
Created March 16, 2012 16:16
Show Gist options
  • Save brianboyer/2050801 to your computer and use it in GitHub Desktop.
Save brianboyer/2050801 to your computer and use it in GitHub Desktop.
Unfuddle ticket generator
import csv, os.path
import os
import httplib, base64
import getpass
username = raw_input("Username:")
password = getpass.getpass("Password:")
subdomain = raw_input("Subdomain:")
project = raw_input("Project id:")
filename = raw_input("Tickets file:")
auth = base64.encodestring("%s:%s" % (username, password)).strip()
headers = {
"Accept": "application/xml",
"Content-Type": "application/xml",
"Authorization" : "Basic %s" % auth}
conn = httplib.HTTPSConnection(subdomain + ".unfuddle.com")
reader = csv.reader(open(filename, "U"))
for ticket in reader:
summary = ticket[0]
conn.request("POST", "/api/v1/projects/%s/tickets" % project, "<ticket><priority>3</priority><summary>" + summary + "</summary></ticket>", headers)
response = conn.getresponse()
print response.status, response.reason, " -- ", summary
conn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment