Consultando el rastreador pivotal desde la línea de comandos

Utilizo este script para consultar el rastreador fundamental desde la línea de comando

import requests
import sys
from lxml import etree

TOKEN
= 'YOUR TOKEN GOES HERE'
PROJECT_URL
= 'YOUR PROJECT URL GOES HERE'


def main(args):
query
= ' '.join(args)
xml
= get_stories(query)
parse
(xml)


def parse(xml):
root
= etree.fromstring(xml)
for story in root.getchildren():
id
= story.find('id').text
name
= story.find('name').text
print "%s %s" % (id, name)

def get_stories(query, token=TOKEN, url=PROJECT_URL):
payload
= {'filter': query}
headers
= {'X-TrackerToken': token}
response
= requests.get(url, params=payload, headers=headers)
return response.content

if __name__ == '__main__':
main
(sys.argv[1:])

El uso es así:

$ pivotal state:unscheduled,unstarted,started label:myproject