Skip to content

Instantly share code, notes, and snippets.

@ejhayes
Last active December 14, 2015 14:49
Show Gist options
  • Save ejhayes/5103674 to your computer and use it in GitHub Desktop.
Save ejhayes/5103674 to your computer and use it in GitHub Desktop.
Basic trac api usage
# Login and authenticate
from xmlrpclib import ServerProxy
p = ServerProxy('http://USERNAME:PASSWORD@trac/storm/login/rpc')
# Query tickets and print out the results
for i in p.ticket.query('owner=eric&status!=closed'):
p.ticket.get(i)
# What ticket attributes are available to pass to the attributes struct?
p.ticket.getTicketFields()
# Get basic ticket info
p.ticket.get(24525)
# Get ticket changelog info
p.ticket.changeLog(24525)
# Multicall with only 1 call
p.system.multicall([{'methodName': 'ticket.get', 'params': [24525]}])
# Get a ticket and hte changelog in 1 call
p.system.multicall([{'methodName': 'ticket.get', 'params': [24525]},{'methodName': 'ticket.changeLog', 'params': [24525]}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment