Make url an option
This commit is contained in:
parent
20467e9e07
commit
0f7d1fa6d2
1 changed files with 13 additions and 9 deletions
20
daily.py
20
daily.py
|
@ -4,20 +4,24 @@ import sys
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
|
import argparse
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
#from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
#requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
|
||||||
date = time.localtime()
|
parser = argparse.ArgumentParser()
|
||||||
if len(sys.argv) > 1:
|
parser.add_argument('-b', '--base-url', required=True)
|
||||||
date = subprocess.check_output(['date','-d',sys.argv[1],'+%s'])
|
parser.add_argument('-d', '--date', default="today")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
date = subprocess.check_output(['date','-d',args.date,'+%s'])
|
||||||
date = float(date)
|
date = float(date)
|
||||||
date = time.localtime(date)
|
date = time.localtime(date)
|
||||||
|
|
||||||
date = time.strftime(r'%Y-%m-%d', date)
|
date = time.strftime(r'%Y-%m-%d', date)
|
||||||
|
|
||||||
url_template = 'https://jira.bloopark.com/rest/tempo-timesheets/3/worklogs?projectKey=PAS&dateFrom={}&dateTo={}&expand=issue.status'
|
url_template = 'https://{base_url}/rest/tempo-timesheets/3/worklogs?projectKey=PAS&dateFrom={date}&dateTo={date}&expand=issue.status'
|
||||||
|
url = url_template.format(base_url=args.base_url, date=date)
|
||||||
|
|
||||||
resp = requests.get(url_template.format(date, date), verify=False)
|
resp = requests.get(url, verify=False)
|
||||||
print(json.dumps(resp.json()))
|
print(json.dumps(resp.json()))
|
||||||
|
|
Loading…
Reference in a new issue