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 json
|
||||
import requests
|
||||
import argparse
|
||||
import subprocess
|
||||
|
||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||
#from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||
#requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||
|
||||
date = time.localtime()
|
||||
if len(sys.argv) > 1:
|
||||
date = subprocess.check_output(['date','-d',sys.argv[1],'+%s'])
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-b', '--base-url', required=True)
|
||||
parser.add_argument('-d', '--date', default="today")
|
||||
args = parser.parse_args()
|
||||
|
||||
date = subprocess.check_output(['date','-d',args.date,'+%s'])
|
||||
date = float(date)
|
||||
date = time.localtime(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()))
|
||||
|
|
Loading…
Reference in a new issue