|
18 | 18 | "#|export\n",
|
19 | 19 | "from fastcore.utils import *\n",
|
20 | 20 | "from fastcore.parallel import *\n",
|
| 21 | + "\n", |
21 | 22 | "from functools import wraps\n",
|
22 |
| - "from pprint import pformat\n", |
23 | 23 | "import json,urllib,contextlib\n",
|
24 | 24 | "import socket,urllib.request,http,urllib\n",
|
25 | 25 | "from contextlib import contextmanager,ExitStack\n",
|
|
184 | 184 | "text/markdown": [
|
185 | 185 | "---\n",
|
186 | 186 | "\n",
|
187 |
| - "[source](https://github.com/fastai/fastcore/blob/master/fastcore/net.py#L64){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 187 | + "[source](https://github.com/fastai/fastcore/blob/master/fastcore/net.py#L63){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
188 | 188 | "\n",
|
189 | 189 | "#### HTTP4xxClientError\n",
|
190 | 190 | "\n",
|
|
195 | 195 | "text/plain": [
|
196 | 196 | "---\n",
|
197 | 197 | "\n",
|
198 |
| - "[source](https://github.com/fastai/fastcore/blob/master/fastcore/net.py#L64){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 198 | + "[source](https://github.com/fastai/fastcore/blob/master/fastcore/net.py#L63){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
199 | 199 | "\n",
|
200 | 200 | "#### HTTP4xxClientError\n",
|
201 | 201 | "\n",
|
|
223 | 223 | "text/markdown": [
|
224 | 224 | "---\n",
|
225 | 225 | "\n",
|
226 |
| - "[source](https://github.com/fastai/fastcore/blob/master/fastcore/net.py#L69){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 226 | + "[source](https://github.com/fastai/fastcore/blob/master/fastcore/net.py#L68){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
227 | 227 | "\n",
|
228 | 228 | "#### HTTP5xxServerError\n",
|
229 | 229 | "\n",
|
|
234 | 234 | "text/plain": [
|
235 | 235 | "---\n",
|
236 | 236 | "\n",
|
237 |
| - "[source](https://github.com/fastai/fastcore/blob/master/fastcore/net.py#L69){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 237 | + "[source](https://github.com/fastai/fastcore/blob/master/fastcore/net.py#L68){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
238 | 238 | "\n",
|
239 | 239 | "#### HTTP5xxServerError\n",
|
240 | 240 | "\n",
|
|
315 | 315 | " if not isinstance(data, bytes): data = data.encode('ascii')\n",
|
316 | 316 | " try: return urlopener().open(urlwrap(url, data=data, headers=headers), timeout=timeout)\n",
|
317 | 317 | " except HTTPError as e: \n",
|
318 |
| - " e.msg += f\"\\n====Error Body====\\n{pformat(json.loads(e.read()))}\"\n", |
319 |
| - " raise e\n", |
320 |
| - " except Exception as e: raise e" |
| 318 | + " e.msg += f\"\\n====Error Body====\\n{e.read().decode(errors='ignore')}\"\n", |
| 319 | + " raise" |
321 | 320 | ]
|
322 | 321 | },
|
323 | 322 | {
|
|
338 | 337 | "text": [
|
339 | 338 | "404 Not Found\n",
|
340 | 339 | "====Error Body====\n",
|
341 |
| - "{'documentation_url': 'https://docs.github.com/rest', 'message': 'Not Found'}\n" |
| 340 | + "{\n", |
| 341 | + " \"message\": \"Not Found\",\n", |
| 342 | + " \"documentation_url\": \"https://docs.github.com/rest\"\n", |
| 343 | + "}\n", |
| 344 | + "\n" |
342 | 345 | ]
|
343 | 346 | }
|
344 | 347 | ],
|
|
0 commit comments