ATLAS Offline Software
submit.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import json
4 import sys
5 import requests
6 
7 print "running ..."
8 
9 sessionid = None
10 with open('cookiefile.txt', 'r') as f:
11  for line in f:
12  line = line.rstrip('\n')
13  if line.find('JSESSIONID') > - 1:
14  sessionid = line.split()[-1]
15 
16 if not sessionid:
17  sys.exit()
18 
19 headers={'cookie': 'JSESSIONID=%s' % (sessionid), 'Content-Type': 'application/json'}
20 
21 i=0
22 myrequest=""
23 
24 for i in xrange(1,len(sys.argv)):
25  if sys.argv[i] == "-f" :
26  with open (sys.argv[i+1], "r") as myfile:
27  myrequest = myfile.read()
28  break
29  else:
30  myrequest += sys.argv[i]
31  myrequest += " "
32  print sys.argv[i]
33 
34 
35 print myrequest
36 
37 
38 if myrequest == "" :
39  print "no message to post"
40  exit(-1)
41 
42 data = {
43  "body": myrequest
44 }
45 
46 result = requests.post('https://its.cern.ch/jira/rest/api/2/issue/ATLINFR-2021/comment', headers=headers, data=json.dumps(data))
47 
48 print json.dumps(result.json(), indent=4)
49 
xrange
void xrange(TH1 *h, bool symmetric)
Definition: computils.cxx:515
calibdata.exit
exit
Definition: calibdata.py:236
Trk::open
@ open
Definition: BinningType.h:40