Last active
March 24, 2017 21:17
Revisions
-
pshchelo revised this gist
Mar 24, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ # import gerritq # g = gerritq.GerritQuery() # user = 'pshchelo' # q = 'owner:%s+status:merged' % user # merged = g.changes(q) # print(len(merged)) -
pshchelo revised this gist
Feb 23, 2017 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,11 +7,9 @@ # user = 'pshchelo' # q = 'owner:%s+status:merged' % s # merged = g.changes(q) # print(len(merged)) import json import requests from six.moves.urllib_parse import urljoin @@ -35,6 +33,9 @@ def changes(self, query): return json.loads(changes) if __name__ == '__main__': import pprint import sys if len(sys.argv) == 1: print("Requires query string as first argument") sys.exit(1) -
pshchelo revised this gist
Feb 23, 2017 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,14 @@ #!/usr/bin/env python # Usage example: # # import gerritq # g = gerritq.GerritQuery() # user = 'pshchelo' # q = 'owner:%s+status:merged' % s # merged = g.changes(q) # print(len(merged) import json import pprint import sys -
pshchelo created this gist
Feb 23, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ #!/usr/bin/env python import json import pprint import sys import requests from six.moves.urllib_parse import urljoin OOO_GERRIT_URL = 'https://review.openstack.org' class GerritQuery(object): def __init__(self, url=OOO_GERRIT_URL): self.base_url = url def changes(self, query): url = urljoin(self.base_url, '/changes/?q=%s' % query) resp = requests.get(url) if not resp.ok: return None # sanitize ")]}'" from response changes = resp.content[4:] return json.loads(changes) if __name__ == '__main__': if len(sys.argv) == 1: print("Requires query string as first argument") sys.exit(1) pprint.pprint(GerritQuery().changes(sys.argv[1]))