-
Notifications
You must be signed in to change notification settings - Fork 44
Description
Using RT 4.2 with RTIR. Still getting a blank Queue when submitting a new ticket. Searching for a ticket gets the correct result. Not sure what i'm doing wrong here. Code follows result block.
[DEBUG] POST ticket/new
[DEBUG] {'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'Accept': 'text/plain'}
[DEBUG] 'content=Queue: IST-Security\nText: My+useless%0A+text+on%0A+three+lines.\nSubject: New Ticket Test'
[INFO] POST
[INFO] http://rt.uwaterloo.ca/REST/1.0/ticket/new
[DEBUG] HTTP_STATUS: 200 OK
[DEBUG] 'RT/4.2.9-43-gd7c0cfd 200 Ok\n\n# Required: id, Queue\n\nid: ticket/new\nQueue: \nRequestor: issminion\nSubject: \nCc:\nAdminCc:\nOwner: \nStatus: new\nPriority: \nInitialPriority: \nFinalPriority: \nTimeEstimated: 0\nStarts: 2014-12-02 10:23:19\nDue: \nAttachment: \nText: \n\n'
[DEBUG] RESOURCE_STATUS: 200 Ok
[INFO] [[('id', 'ticket/new'), ('Queue', ''), ('Requestor', 'issminion'), ('Subject', ''), ('Cc', ''), ('AdminCc', ''), ('Owner', ''), ('Status', 'new'), ('Priority', ''), ('InitialPriority', ''), ('FinalPriority', ''), ('TimeEstimated', '0'), ('Starts', '2014-12-02 10:23:19'), ('Due', ''), ('Attachment', ''), ('Text', '')]]
[INFO] [[('id', 'ticket/new'), ('Queue', ''), ('Requestor', 'issminion'), ('Subject', ''), ('Cc', ''), ('AdminCc', ''), ('Owner', ''), ('Status', 'new'), ('Priority', ''), ('InitialPriority', ''), ('FinalPriority', ''), ('TimeEstimated', '0'), ('Starts', '2014-12-02 10:23:19'), ('Due', ''), ('Attachment', ''), ('Text', '')]]
!/usr/bin/env python
import sys
import re
import smtplib
import subprocess
import os
import rt
import ConfigParser
import time
from rtkit.resource import RTResource
from rtkit.authenticators import QueryStringAuthenticator
from rtkit.errors import RTResourceError
from rtkit import set_logging
import logging
set_logging('debug')
logger = logging.getLogger('rtkit')
config = ConfigParser.RawConfigParser()
config.read(os.path.expanduser('~/.rtrcp'))
notkit rtpoint = "https://{0}/REST/1.0/".format(config.get('rt','hostname'))
rtuser = config.get('rt','username')
rtpass = config.get('rt','password')
rthost = config.get('rt','hostname')
resource = RTResource('http://{0}/REST/1.0/', '{1}', '{2}', BasicAuthenticator).format(rthost,rtuser,rtpass)
try:
resource = RTResource('http://rt.uwaterloo.ca/REST/1.0/', rtuser, rtpass, QueryStringAuthenticator)
except:
print rtuser, rtpass, rthost
print "Oops."
sys.exit(0)
content = {
'content': {
'Queue': 'IST-Security',
'Subject': 'New Ticket Test',
'Text': 'My useless\ntext on\nthree lines.',
}
}
try:
response = resource.post(path='ticket/new', payload=content,)
logger.info(response.parsed)
except RTResourceError as e:
logger.error(e.response.status_int)
logger.error(e.response.status)
logger.error(e.response.parsed)