#!../flask/bin/python """ usage: bug list [options] If no arguments are given it will open your $EDITOR where the first line is the summary following a newline and then the body of the report. Both are required. -h, --help Print this help text """ from docopt import docopt from textwrap import indent from datetime import datetime from bug_show import show_ticket import json, requests, sys if __name__ == '__main__': print(docopt(__doc__)) def entrypoint(args): print(args) api_endpoint = args['--uri'] + '/api/1.0/tickets' r = requests.get(api_endpoint, verify=False) tickets = json.loads(r.text) if not tickets: sys.exit("No tickets found.") tickets = tickets.get('tickets') for ticket in tickets: print(show_ticket(ticket))