Skip to content

Commit

Permalink
fixes #182
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 committed Aug 25, 2024
1 parent 4fe9459 commit 96bd017
Show file tree
Hide file tree
Showing 15 changed files with 110 additions and 42 deletions.
36 changes: 19 additions & 17 deletions 00_core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
" self.debug,self.limit_cb,self.limit_rem = debug,limit_cb,5000\n",
" self.gh_host = gh_host or GH_HOST\n",
"\n",
" def __call__(self, path:str, verb:str=None, headers:dict=None, route:dict=None, query:dict=None, data=None):\n",
" def __call__(self, path:str, verb:str=None, headers:dict=None, route:dict=None, query:dict=None, data=None, timeout=None):\n",
" \"Call a fully specified `path` using HTTP `verb`, passing arguments to `fastcore.core.urlsend`\"\n",
" if verb is None: verb = 'POST' if data else 'GET'\n",
" headers = {**self.headers,**(headers or {})}\n",
Expand All @@ -212,7 +212,7 @@
" return_json = ('json' in headers['Accept'])\n",
" debug = self.debug if self.debug else print_summary if os.getenv('GHAPI_DEBUG') else None\n",
" res,self.recv_hdrs = urlsend(path, verb, headers=headers or None, debug=debug, return_headers=True,\n",
" route=route or None, query=query or None, data=data or None, return_json=return_json)\n",
" route=route or None, query=query or None, data=data or None, return_json=return_json, timeout=timeout)\n",
" if 'X-RateLimit-Remaining' in self.recv_hdrs:\n",
" newlim = self.recv_hdrs['X-RateLimit-Remaining']\n",
" if self.limit_cb is not None and newlim != self.limit_rem:\n",
Expand Down Expand Up @@ -266,9 +266,10 @@
"### GhApi.__call__\n",
"\n",
"> GhApi.__call__ (path:str, verb:str=None, headers:dict=None,\n",
"> route:dict=None, query:dict=None, data=None)\n",
"> route:dict=None, query:dict=None, data=None,\n",
"> timeout=None)\n",
"\n",
"Call a fully specified `path` using HTTP `verb`, passing arguments to `fastcore.core.urlsend`"
"*Call a fully specified `path` using HTTP `verb`, passing arguments to `fastcore.core.urlsend`*"
],
"text/plain": [
"---\n",
Expand All @@ -278,9 +279,10 @@
"### GhApi.__call__\n",
"\n",
"> GhApi.__call__ (path:str, verb:str=None, headers:dict=None,\n",
"> route:dict=None, query:dict=None, data=None)\n",
"> route:dict=None, query:dict=None, data=None,\n",
"> timeout=None)\n",
"\n",
"Call a fully specified `path` using HTTP `verb`, passing arguments to `fastcore.core.urlsend`"
"*Call a fully specified `path` using HTTP `verb`, passing arguments to `fastcore.core.urlsend`*"
]
},
"execution_count": null,
Expand Down Expand Up @@ -318,9 +320,9 @@
"text/markdown": [
"```json\n",
"{ 'node_id': 'MDM6UmVmMzE1NzEyNTg4OnJlZnMvaGVhZHMvbWFzdGVy',\n",
" 'object': { 'sha': '3d27c573b7f9bdea704289567603f1d02e7e113b',\n",
" 'object': { 'sha': '17efbb7eb346f0f9161c227af9c8db93597321e2',\n",
" 'type': 'commit',\n",
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/3d27c573b7f9bdea704289567603f1d02e7e113b'},\n",
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/17efbb7eb346f0f9161c227af9c8db93597321e2'},\n",
" 'ref': 'refs/heads/master',\n",
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/refs/heads/master'}\n",
"```"
Expand All @@ -329,9 +331,9 @@
"{'ref': 'refs/heads/master',\n",
" 'node_id': 'MDM6UmVmMzE1NzEyNTg4OnJlZnMvaGVhZHMvbWFzdGVy',\n",
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/refs/heads/master',\n",
" 'object': {'sha': '3d27c573b7f9bdea704289567603f1d02e7e113b',\n",
" 'object': {'sha': '17efbb7eb346f0f9161c227af9c8db93597321e2',\n",
" 'type': 'commit',\n",
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/3d27c573b7f9bdea704289567603f1d02e7e113b'}}"
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/17efbb7eb346f0f9161c227af9c8db93597321e2'}}"
]
},
"execution_count": null,
Expand Down Expand Up @@ -360,7 +362,7 @@
"\n",
"> GhApi.__getitem__ (k)\n",
"\n",
"Lookup and call an endpoint by path and verb (which defaults to 'GET')"
"*Lookup and call an endpoint by path and verb (which defaults to 'GET')*"
],
"text/plain": [
"---\n",
Expand All @@ -371,7 +373,7 @@
"\n",
"> GhApi.__getitem__ (k)\n",
"\n",
"Lookup and call an endpoint by path and verb (which defaults to 'GET')"
"*Lookup and call an endpoint by path and verb (which defaults to 'GET')*"
]
},
"execution_count": null,
Expand Down Expand Up @@ -400,9 +402,9 @@
"text/markdown": [
"```json\n",
"{ 'node_id': 'MDM6UmVmMzE1NzEyNTg4OnJlZnMvaGVhZHMvbWFzdGVy',\n",
" 'object': { 'sha': '3d27c573b7f9bdea704289567603f1d02e7e113b',\n",
" 'object': { 'sha': '17efbb7eb346f0f9161c227af9c8db93597321e2',\n",
" 'type': 'commit',\n",
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/3d27c573b7f9bdea704289567603f1d02e7e113b'},\n",
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/17efbb7eb346f0f9161c227af9c8db93597321e2'},\n",
" 'ref': 'refs/heads/master',\n",
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/refs/heads/master'}\n",
"```"
Expand All @@ -411,9 +413,9 @@
"{'ref': 'refs/heads/master',\n",
" 'node_id': 'MDM6UmVmMzE1NzEyNTg4OnJlZnMvaGVhZHMvbWFzdGVy',\n",
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/refs/heads/master',\n",
" 'object': {'sha': '3d27c573b7f9bdea704289567603f1d02e7e113b',\n",
" 'object': {'sha': '17efbb7eb346f0f9161c227af9c8db93597321e2',\n",
" 'type': 'commit',\n",
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/3d27c573b7f9bdea704289567603f1d02e7e113b'}}"
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/17efbb7eb346f0f9161c227af9c8db93597321e2'}}"
]
},
"execution_count": null,
Expand Down Expand Up @@ -1724,7 +1726,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "python3",
"language": "python",
"name": "python3"
}
Expand Down
2 changes: 1 addition & 1 deletion 01_actions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "python3",
"language": "python",
"name": "python3"
}
Expand Down
2 changes: 1 addition & 1 deletion 02_auth.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "python3",
"language": "python",
"name": "python3"
}
Expand Down
2 changes: 1 addition & 1 deletion 03_page.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "python3",
"language": "python",
"name": "python3"
}
Expand Down
4 changes: 2 additions & 2 deletions 04_event.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 10_cli.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "python3",
"language": "python",
"name": "python3"
}
Expand Down
2 changes: 1 addition & 1 deletion 50_fullapi.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "python3",
"language": "python",
"name": "python3"
}
Expand Down
2 changes: 1 addition & 1 deletion 90_build_lib.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "python3",
"language": "python",
"name": "python3"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/_create_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "python3",
"language": "python",
"name": "python3"
}
Expand Down
1 change: 1 addition & 0 deletions examples/build.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env python
from ghapi.build_lib import *
build_funcs()
4 changes: 2 additions & 2 deletions ghapi/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__(self, owner=None, repo=None, token=None, jwt_token=None, debug=None
self.debug,self.limit_cb,self.limit_rem = debug,limit_cb,5000
self.gh_host = gh_host or GH_HOST

def __call__(self, path:str, verb:str=None, headers:dict=None, route:dict=None, query:dict=None, data=None):
def __call__(self, path:str, verb:str=None, headers:dict=None, route:dict=None, query:dict=None, data=None, timeout=None):
"Call a fully specified `path` using HTTP `verb`, passing arguments to `fastcore.core.urlsend`"
if verb is None: verb = 'POST' if data else 'GET'
headers = {**self.headers,**(headers or {})}
Expand All @@ -118,7 +118,7 @@ def __call__(self, path:str, verb:str=None, headers:dict=None, route:dict=None,
return_json = ('json' in headers['Accept'])
debug = self.debug if self.debug else print_summary if os.getenv('GHAPI_DEBUG') else None
res,self.recv_hdrs = urlsend(path, verb, headers=headers or None, debug=debug, return_headers=True,
route=route or None, query=query or None, data=data or None, return_json=return_json)
route=route or None, query=query or None, data=data or None, return_json=return_json, timeout=timeout)
if 'X-RateLimit-Remaining' in self.recv_hdrs:
newlim = self.recv_hdrs['X-RateLimit-Remaining']
if self.limit_cb is not None and newlim != self.limit_rem:
Expand Down
Loading

0 comments on commit 96bd017

Please sign in to comment.