From 456147792a6c6d25699f8ebcd8ddd8e8806feac3 Mon Sep 17 00:00:00 2001 From: Manas Date: Jun 04 2019 16:39:10 +0000 Subject: taiga user story functionality modules created. --- diff --git a/tga/userstory.py b/tga/userstory.py index 8c1d9ee..2ff90df 100644 --- a/tga/userstory.py +++ b/tga/userstory.py @@ -4,8 +4,21 @@ import json config = configparser.ConfigParser() config.read('config.ini') +service_id = config['TAIGA']['SERVICE_ID'] # service id +service_token = config['TAIGA']['SERVICE_TOKEN'] +pid = config['TAIGA']['PID'] +if config['TAIGA']['TEST'] == 'yes': + taiga_url = config['TAIGA']['CUSTOM_TAIGA_URL'] + status = config['TAIGA']['STATUS_R_FESCO'] +elif config['TAIGA']['TEST'] == 'no': + taiga_url = config['TAIGA']['DEFAULT_TAIGA_URL'] + status = config['TAIGA']['STATUS'] +else: + print("please set test status in config") + def list_us(): + """ service_id = config['TAIGA']['SERVICE_ID'] # service id service_token = config['TAIGA']['SERVICE_TOKEN'] pid = config['TAIGA']['PID'] @@ -17,6 +30,7 @@ def list_us(): status = config['TAIGA']['STATUS'] else: print("please set test status in config") + """ try: url = str(taiga_url) + "/api/v1/issues/userstories?project=" + str(pid) + "\&status=" + str(status) @@ -40,6 +54,7 @@ def list_us(): def get_us(): + """ service_id = config['TAIGA']['SERVICE_ID'] # service id service_token = config['TAIGA']['SERVICE_TOKEN'] pid = config['TAIGA']['PID'] @@ -51,4 +66,32 @@ def get_us(): status = config['TAIGA']['STATUS'] else: print("please set test status in config") - \ No newline at end of file + """ + + +def post_us(args): + for _, value in args._get_kwargs(): # iteratingover name space object + for x in value: + try: + r = requests.post( + 'https://api.taiga.io/api/v1/userstories', + data=json.dumps(x), + headers=headers + ) + return r + except requests.exceptions.RequestException at e: + print(e) + + +def post_us_ca(args, id): + or _, value in args._get_kwargs(): # iteratingover name space object + for x in value: + try: + r = requests.post( + 'https://api.taiga.io/api/v1/userstories' + str(id), + data=json.dumps(x), + headers=headers + ) + return r + except requests.exceptions.RequestException at e: + print(e) \ No newline at end of file