Permalink
Browse files

Drop support for deceased Github API v2

  • Loading branch information...
1 parent 262c423 commit 26fdbf6d68b11978498db8e9a207f622878f3475 @takluyver committed Jul 16, 2012
Showing with 4 additions and 18 deletions.
  1. +4 −18 tools/gh_api.py
View
@@ -86,34 +86,20 @@ def post_gist(content, description='', filename='file', auth=False):
response_data = json.loads(response.text)
return response_data['html_url']
-def get_pull_request(project, num, github_api=3):
+def get_pull_request(project, num):
"""get pull request info by number
-
- github_api : version of github api to use
"""
- if github_api==2 :
- url = "http://github.com/api/v2/json/pulls/{project}/{num}".format(project=project, num=num)
- elif github_api == 3:
- url = "https://api.github.com/repos/{project}/pulls/{num}".format(project=project, num=num)
+ url = "https://api.github.com/repos/{project}/pulls/{num}".format(project=project, num=num)
response = requests.get(url)
response.raise_for_status()
- if github_api == 2 :
- return json.loads(response.text)['pull']
return json.loads(response.text, object_hook=Obj)
-def get_pulls_list(project, github_api=3):
+def get_pulls_list(project):
"""get pull request list
-
- github_api : version of github api to use
"""
- if github_api == 3 :
- url = "https://api.github.com/repos/{project}/pulls".format(project=project)
- else :
- url = "http://github.com/api/v2/json/pulls/{project}".format(project=project)
+ url = "https://api.github.com/repos/{project}/pulls".format(project=project)
response = requests.get(url)
response.raise_for_status()
- if github_api == 2 :
- return json.loads(response.text)['pulls']
return json.loads(response.text)
# encode_multipart_formdata is from urllib3.filepost

0 comments on commit 26fdbf6

Please sign in to comment.