19def queryJira(querystring, cookies):
20
21 base_url = "https://its.cern.ch/jira/rest/api/2/"
22 url = base_url+querystring
23
24 r = requests.get(url, cookies=cookies)
25 if r.status_code != 200:
26 if r.status_code == 401:
27 print ('Authorisation has failed. Have you got a valid SSO cookie? If not, re-run "cern-get-sso-cookie -u https://its.cern.ch/jira/loginCern.jsp -o jira.txt" ')
28 else:
29 print ("Something has gone wrong! The response is: ", r.text)
30 return
31
32 import json
33 response = json.loads(r.text)
34 return response
35
36@acmdlib.command(name='jira.issues')
37@acmdlib.argument('-c', '--cookies',
38 required=False,
39 default = 'jira.txt',
40 help='the CERN SSO cookies file')
41@acmdlib.argument('-r', '--release',
42 required=False,
43 help='Limit the response to the specified release')
44@acmdlib.argument('-m', '--myissues',
45 action='store_true',
46 default=True,
47 required=False,
48 help='Limit the response your own issues')
49@acmdlib.argument('-q', '--query',
50 required=False,
51 help='Use the specified query string i.e. "search?jql=assignee=currentUser()+and+resolution=Unresolved"')
52@acmdlib.argument('-s', '--status',
53 required=False,
54 help='Limit the search to issues with this status, e.g. "Open"')
55