|
16 | 16 | import requests
|
17 | 17 | import shutil
|
18 | 18 | from subprocess import call, check_call, check_output, PIPE, STDOUT, CalledProcessError
|
19 |
| -try: |
20 |
| - from urllib.request import urlopen |
21 |
| -except ImportError: |
22 |
| - from urllib2 import urlopen |
23 | 19 |
|
24 | 20 | import gh_auth
|
25 | 21 |
|
@@ -72,8 +68,7 @@ def setup():
|
72 | 68 |
|
73 | 69 | def get_pull_request(num):
|
74 | 70 | url = "https://api.github.com/repos/{project}/pulls/{num}".format(project=gh_project, num=num)
|
75 |
| - response = urlopen(url).read().decode('utf-8') |
76 |
| - return json.loads(response) |
| 71 | + return json.loads(requests.get(url).text) |
77 | 72 |
|
78 | 73 | missing_libs_re = re.compile(r"Tools and libraries NOT available at test time:\n"
|
79 | 74 | r"\s*(.*?)\n")
|
@@ -125,8 +120,8 @@ def post_gist(content, description='IPython test log', filename="results.log"):
|
125 | 120 | }
|
126 | 121 | }).encode('utf-8')
|
127 | 122 |
|
128 |
| - response = urlopen("https://api.github.com/gists", post_data) |
129 |
| - response_data = json.loads(response.read().decode('utf-8')) |
| 123 | + response = requests.post("https://api.github.com/gists", data=post_data) |
| 124 | + response_data = json.loads(response.text) |
130 | 125 | return response_data['html_url']
|
131 | 126 |
|
132 | 127 | def markdown_format(pr, results):
|
@@ -159,7 +154,7 @@ def post_results_comment(pr, results, num):
|
159 | 154 | auth_token = gh_auth.get_auth_token()
|
160 | 155 | headers = {'Authorization': 'token ' + auth_token}
|
161 | 156 | r = requests.post(url, data=payload, headers=headers)
|
162 |
| - |
| 157 | + |
163 | 158 |
|
164 | 159 | if __name__ == '__main__':
|
165 | 160 | import sys
|
|
0 commit comments