Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fastcore/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ def urlread(url, data=None, headers=None, decode=True, return_json=False, return
return (res,dict(hdrs)) if return_headers else res

# %% ../nbs/03b_net.ipynb
def urljson(url, data=None, timeout=None):
def urljson(url, data=None, headers=None, timeout=None):
"Retrieve `url` and decode json"
res = urlread(url, data=data, timeout=timeout)
res = urlread(url, data=data, headers=headers, timeout=timeout)
return json.loads(res) if res else {}

# %% ../nbs/03b_net.ipynb
Expand Down
15 changes: 8 additions & 7 deletions nbs/03b_net.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
"text/markdown": [
"---\n",
"\n",
"[source](https://github.com/fastai/fastcore/blob/master/fastcore/net.py#L64){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"[source](https://github.com/AnswerDotAI/fastcore/blob/master/fastcore/net.py#L67){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"\n",
"#### HTTP4xxClientError\n",
"\n",
Expand All @@ -202,7 +202,7 @@
"text/plain": [
"---\n",
"\n",
"[source](https://github.com/fastai/fastcore/blob/master/fastcore/net.py#L64){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"[source](https://github.com/AnswerDotAI/fastcore/blob/master/fastcore/net.py#L67){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"\n",
"#### HTTP4xxClientError\n",
"\n",
Expand Down Expand Up @@ -230,7 +230,7 @@
"text/markdown": [
"---\n",
"\n",
"[source](https://github.com/fastai/fastcore/blob/master/fastcore/net.py#L69){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"[source](https://github.com/AnswerDotAI/fastcore/blob/master/fastcore/net.py#L72){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"\n",
"#### HTTP5xxServerError\n",
"\n",
Expand All @@ -241,7 +241,7 @@
"text/plain": [
"---\n",
"\n",
"[source](https://github.com/fastai/fastcore/blob/master/fastcore/net.py#L69){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"[source](https://github.com/AnswerDotAI/fastcore/blob/master/fastcore/net.py#L72){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"\n",
"#### HTTP5xxServerError\n",
"\n",
Expand Down Expand Up @@ -347,7 +347,8 @@
"====Error Body====\n",
"{\n",
" \"message\": \"Not Found\",\n",
" \"documentation_url\": \"https://docs.github.com/rest\"\n",
" \"documentation_url\": \"https://docs.github.com/rest\",\n",
" \"status\": \"404\"\n",
"}\n",
"\n"
]
Expand Down Expand Up @@ -387,9 +388,9 @@
"outputs": [],
"source": [
"#|export\n",
"def urljson(url, data=None, timeout=None):\n",
"def urljson(url, data=None, headers=None, timeout=None):\n",
" \"Retrieve `url` and decode json\"\n",
" res = urlread(url, data=data, timeout=timeout)\n",
" res = urlread(url, data=data, headers=headers, timeout=timeout)\n",
" return json.loads(res) if res else {}"
]
},
Expand Down