#!../flask/bin/python """ usage: bug delete [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 -i, --ticket-id ID of the ticket to delete """ from docopt import docopt import json, requests if __name__ == '__main__': print(docopt(__doc__)) def call(args): print(args) api_endpoint = args['--uri'] + '/api/1.0/ticket/' req = requests.delete(api_endpoint + args['']) res = json.loads(req.text) if req.status_code == 404: print("Ticket with ID '{}' could not be deleted: {}".format(args[''], res['error'])) elif req.status_code == 200: print("Ticket with ID '{}' deleted successfully.".format(args[''])) else: exit("ALERT ALERT ALERT") #print("{} {}\n {}".format(t['id'], t['title'], t['uri']))