Skip to content

Commit

Permalink
Allow overriding of query and headers
Browse files Browse the repository at this point in the history
  • Loading branch information
m42e committed Sep 7, 2015
1 parent 832aa3f commit 2c5dde0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions py/vimjira.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ def jira_complete(url, user, pw, need_retry=True):
query = "jql=assignee=%s+and+resolution=unresolved" % user
if type(url) == type(dict()):
raw_url = url['url']
api_url = "%s/rest/api/2/search?%s" % (raw_url, query)
args = url.copy()
if 'query' in url:
query = url['query']
args.pop('query')
if 'headers' in url and type(url['headers']) == type(dict()):
headers.update(url['headers'])
args.pop('headers')
api_url = "%s/rest/api/2/search?%s" % (raw_url, query)
args.pop('url')
for k in args.keys():
if args[k] == 'False' or args[k] == 'True':
Expand All @@ -37,8 +43,6 @@ def jira_complete(url, user, pw, need_retry=True):
api_url = "%s/rest/api/2/search?%s" % (url, query)
response = requests.get(api_url, headers=headers)

print "api_url: ", api_url
print "headers: ", headers
if response.status_code == requests.codes.ok:
jvalue = json.loads(response.content)
issues = jvalue['issues']
Expand Down

0 comments on commit 2c5dde0

Please sign in to comment.