From e5e1b79433f1fd1e3a0615c6fe54a2c0224cdc48 Mon Sep 17 00:00:00 2001 From: David Kaufmann Date: Mon, 26 Nov 2018 00:12:11 +0100 Subject: [PATCH] extend autoclick functionality --- camunda-overlay/camunda.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/camunda-overlay/camunda.py b/camunda-overlay/camunda.py index da4e5d7..369d69c 100755 --- a/camunda-overlay/camunda.py +++ b/camunda-overlay/camunda.py @@ -14,6 +14,13 @@ def get_current_deployments(key = 'sentiment-analysis'): #return [proc for proc in res.json() if proc['name'] == key] return res.json() +def get_current_process_instances(key = 'sentiment-analysis'): + res = requests.get(CAMUNDA + 'process-instance') + if (key is None): + return res.json() + else: + return [instance for instance in res.json() if instance['definitionId'].startswith(key + ":")] + def cleanup_old_deployments(key='sentiment-analysis'): print ("Cleaning up old deployments") for deployment in get_current_deployments(key): @@ -77,6 +84,15 @@ def submit_terms(terms): except: pprint(res.content) +def download_pdf(): + instances = get_current_process_instances() + instance = instances[0]['id'] + res = requests.get(CAMUNDA + 'process-instance/' + instance + '/variables') + try: + pprint(res.json()) + except: + pprint(res.content) + if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--deploy', dest='deploy', default=True, action='store_false', help="Do deployment step") @@ -91,3 +107,6 @@ if __name__ == "__main__": if args.autoclick >= 1: # start clicking submit_terms(["voting", "phonegate", "35c3"]) + + if args.autoclick >= 2: + download_pdf() -- 2.43.0