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