You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pd...@apache.org on 2014/09/21 15:56:32 UTC

[2/6] git commit: jira.py: add authentication now required by https://issues.apache.org/jira

jira.py: add authentication now required by https://issues.apache.org/jira


Project: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-rn/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-rn/commit/f36e3007
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-rn/tree/f36e3007
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-rn/diff/f36e3007

Branch: refs/heads/4.4
Commit: f36e30077bcd9c1aecadf3b1b6316e56ab708fc3
Parents: 632de41
Author: Pierre-Luc Dion <pd...@apache.org>
Authored: Sat Sep 20 11:02:54 2014 -0400
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sat Sep 20 11:02:54 2014 -0400

----------------------------------------------------------------------
 utils/jira.py | 39 +++++++++++++++++++++++++++++++--------
 1 file changed, 31 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack-docs-rn/blob/f36e3007/utils/jira.py
----------------------------------------------------------------------
diff --git a/utils/jira.py b/utils/jira.py
index c4b931d..e843cba 100755
--- a/utils/jira.py
+++ b/utils/jira.py
@@ -14,25 +14,48 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
- 
+"""jira.py: Output jira issues from https://issues.apache.org/jira into RST format for Apche CloudStack Release-Notes.
+
+Usage:
+  jira.py FILTERID -p USERNAME -u PASSWORD
+  jira.py (-h | --help)
+  jira.py --version
+
+Options:
+  -h --help     Show this screen.
+  --version     Show version.
+
+"""
+from docopt import docopt
 import requests
 import json
 import sys
 import pprint
- 
-filterid=str(sys.argv[1])
-filterurl='https://issues.apache.org/jira/rest/api/2/filter/' + filterid
- 
-r=requests.get(filterurl)
+
+
+if __name__ == '__main__':
+    arguments = docopt(__doc__, version='jira.py 2.0')
+    #print(arguments)
+
+#print arguments['FILTERID']
+#print arguments['PASSWORD']
+#print arguments['USERNAME']
+
+filterurl='https://issues.apache.org/jira/rest/api/2/filter/' + arguments['FILTERID']
+
+
+r=requests.get(filterurl, auth=(arguments['USERNAME'],arguments['PASSWORD']))
 rlist=r.json()['searchUrl']
 
-count=requests.get(rlist).json()['total']
+get_all=requests.get(rlist, auth=(arguments['USERNAME'],arguments['PASSWORD'])).json()
+count=get_all['total']
 
+#print count
 n, m = divmod(count, 50)
 
 for i in range(n+1):
 
-    issueslist=requests.get(rlist+'&startAt='+str(i*50)).json()['issues']
+    issueslist=get_all['issues']
 
     for issue in issueslist:
         '''assignee=issue['fields']['assignee']['displayName']