##// END OF EJS Templates
Drop support for deceased Github API v2
Thomas Kluyver -
Show More
@@ -86,34 +86,20 b" def post_gist(content, description='', filename='file', auth=False):"
86 response_data = json.loads(response.text)
86 response_data = json.loads(response.text)
87 return response_data['html_url']
87 return response_data['html_url']
88
88
89 def get_pull_request(project, num, github_api=3):
89 def get_pull_request(project, num):
90 """get pull request info by number
90 """get pull request info by number
91
92 github_api : version of github api to use
93 """
91 """
94 if github_api==2 :
92 url = "https://api.github.com/repos/{project}/pulls/{num}".format(project=project, num=num)
95 url = "http://github.com/api/v2/json/pulls/{project}/{num}".format(project=project, num=num)
96 elif github_api == 3:
97 url = "https://api.github.com/repos/{project}/pulls/{num}".format(project=project, num=num)
98 response = requests.get(url)
93 response = requests.get(url)
99 response.raise_for_status()
94 response.raise_for_status()
100 if github_api == 2 :
101 return json.loads(response.text)['pull']
102 return json.loads(response.text, object_hook=Obj)
95 return json.loads(response.text, object_hook=Obj)
103
96
104 def get_pulls_list(project, github_api=3):
97 def get_pulls_list(project):
105 """get pull request list
98 """get pull request list
106
107 github_api : version of github api to use
108 """
99 """
109 if github_api == 3 :
100 url = "https://api.github.com/repos/{project}/pulls".format(project=project)
110 url = "https://api.github.com/repos/{project}/pulls".format(project=project)
111 else :
112 url = "http://github.com/api/v2/json/pulls/{project}".format(project=project)
113 response = requests.get(url)
101 response = requests.get(url)
114 response.raise_for_status()
102 response.raise_for_status()
115 if github_api == 2 :
116 return json.loads(response.text)['pulls']
117 return json.loads(response.text)
103 return json.loads(response.text)
118
104
119 # encode_multipart_formdata is from urllib3.filepost
105 # encode_multipart_formdata is from urllib3.filepost
General Comments 0
You need to be logged in to leave comments. Login now