From 26fdbf6d68b11978498db8e9a207f622878f3475 2012-07-16 12:52:43 From: Thomas Kluyver Date: 2012-07-16 12:52:43 Subject: [PATCH] Drop support for deceased Github API v2 --- diff --git a/tools/gh_api.py b/tools/gh_api.py index e992acf..3c852f4 100644 --- a/tools/gh_api.py +++ b/tools/gh_api.py @@ -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