Search code examples
pythonrestsyntax-errorrt

unknown RT error message


I'm trying to debug a script that's trying to talk to RT (Request Tracker) and I'm getting the following output:

RT/3.6.6 409 Syntax Error

# Syntax Error

>>ARRAY(0x2b3495f37750)

I have no idea what this error means in the context of RT given the astounding lack of detail making it difficult to debug. Here's the associated code for a little context, it's a script trying to create a ticket.

import requests

def combDicts(dicts):
    out = {}
    for d in dicts:
        out.update(d)
    return out

operPath = 'ticket/new'
credentials = {'user': 'myuser', 'pass': 'mypassword'}
content = {
    'content': {
        'id': 'ticket/new',
        'Subject': 'Python Script Test',
        'Queue': 'General - unassigned',
    }
}
r = requests.post('https://rt.hdms.com/REST/1.0/' + operPath, params=combDicts((credentials, content)), verify = False)
print r.text

If I comment out all but the Queue line of the content dict the error changes to:

RT/3.6.6 409 Syntax Error

# Syntax Error

>> Queue

The crux of my question is this: Does anyone know what this error means or know where I can find documentation on what all the RT errors are and what could cause them?


Solution

  • You'll find much more information in the logs on the RT server itself, especially if you up the log level to debug. You might have better luck using one of the python libraries available for calling RT. However, the version of RT you're running is fairly old, released in Jan. 2008. You may have trouble using current libraries with an old version of RT.