Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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()
Add Comment
Please, Sign In to add comment