Repository navigation
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)
Activity
z4r commentedon Dec 3, 2014
Could you try to retrieve a tkt?
mgaulton commentedon Dec 3, 2014
Retrieving a ticket using the below works. Hence my confusion. :)
#!/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)
try:
response = resource.get(path='ticket/386422')
for r in response.parsed:
for t in r:
logger.info(t)
except RTResourceError as e:
logger.error(e.response.status_int)
logger.error(e.response.status)
logger.error(e.response.parsed)
z4r commentedon Dec 3, 2014
Could you write here your logger output?
mgaulton commentedon Dec 3, 2014
Can I message it to you offline, its got some info i'd rather not post publicly.
On 12/3/14, Andrea de Marco notifications@github.com wrote:
z4r commentedon Dec 3, 2014
sure, contact me on skype: z4erre