|
201 | 201 | " self.debug,self.limit_cb,self.limit_rem = debug,limit_cb,5000\n", |
202 | 202 | " self.gh_host = gh_host or GH_HOST\n", |
203 | 203 | "\n", |
204 | | - " def __call__(self, path:str, verb:str=None, headers:dict=None, route:dict=None, query:dict=None, data=None):\n", |
| 204 | + " def __call__(self, path:str, verb:str=None, headers:dict=None, route:dict=None, query:dict=None, data=None, timeout=None):\n", |
205 | 205 | " \"Call a fully specified `path` using HTTP `verb`, passing arguments to `fastcore.core.urlsend`\"\n", |
206 | 206 | " if verb is None: verb = 'POST' if data else 'GET'\n", |
207 | 207 | " headers = {**self.headers,**(headers or {})}\n", |
|
212 | 212 | " return_json = ('json' in headers['Accept'])\n", |
213 | 213 | " debug = self.debug if self.debug else print_summary if os.getenv('GHAPI_DEBUG') else None\n", |
214 | 214 | " res,self.recv_hdrs = urlsend(path, verb, headers=headers or None, debug=debug, return_headers=True,\n", |
215 | | - " route=route or None, query=query or None, data=data or None, return_json=return_json)\n", |
| 215 | + " route=route or None, query=query or None, data=data or None, return_json=return_json, timeout=timeout)\n", |
216 | 216 | " if 'X-RateLimit-Remaining' in self.recv_hdrs:\n", |
217 | 217 | " newlim = self.recv_hdrs['X-RateLimit-Remaining']\n", |
218 | 218 | " if self.limit_cb is not None and newlim != self.limit_rem:\n", |
|
266 | 266 | "### GhApi.__call__\n", |
267 | 267 | "\n", |
268 | 268 | "> GhApi.__call__ (path:str, verb:str=None, headers:dict=None,\n", |
269 | | - "> route:dict=None, query:dict=None, data=None)\n", |
| 269 | + "> route:dict=None, query:dict=None, data=None,\n", |
| 270 | + "> timeout=None)\n", |
270 | 271 | "\n", |
271 | | - "Call a fully specified `path` using HTTP `verb`, passing arguments to `fastcore.core.urlsend`" |
| 272 | + "*Call a fully specified `path` using HTTP `verb`, passing arguments to `fastcore.core.urlsend`*" |
272 | 273 | ], |
273 | 274 | "text/plain": [ |
274 | 275 | "---\n", |
|
278 | 279 | "### GhApi.__call__\n", |
279 | 280 | "\n", |
280 | 281 | "> GhApi.__call__ (path:str, verb:str=None, headers:dict=None,\n", |
281 | | - "> route:dict=None, query:dict=None, data=None)\n", |
| 282 | + "> route:dict=None, query:dict=None, data=None,\n", |
| 283 | + "> timeout=None)\n", |
282 | 284 | "\n", |
283 | | - "Call a fully specified `path` using HTTP `verb`, passing arguments to `fastcore.core.urlsend`" |
| 285 | + "*Call a fully specified `path` using HTTP `verb`, passing arguments to `fastcore.core.urlsend`*" |
284 | 286 | ] |
285 | 287 | }, |
286 | 288 | "execution_count": null, |
|
318 | 320 | "text/markdown": [ |
319 | 321 | "```json\n", |
320 | 322 | "{ 'node_id': 'MDM6UmVmMzE1NzEyNTg4OnJlZnMvaGVhZHMvbWFzdGVy',\n", |
321 | | - " 'object': { 'sha': '3d27c573b7f9bdea704289567603f1d02e7e113b',\n", |
| 323 | + " 'object': { 'sha': '17efbb7eb346f0f9161c227af9c8db93597321e2',\n", |
322 | 324 | " 'type': 'commit',\n", |
323 | | - " 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/3d27c573b7f9bdea704289567603f1d02e7e113b'},\n", |
| 325 | + " 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/17efbb7eb346f0f9161c227af9c8db93597321e2'},\n", |
324 | 326 | " 'ref': 'refs/heads/master',\n", |
325 | 327 | " 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/refs/heads/master'}\n", |
326 | 328 | "```" |
|
329 | 331 | "{'ref': 'refs/heads/master',\n", |
330 | 332 | " 'node_id': 'MDM6UmVmMzE1NzEyNTg4OnJlZnMvaGVhZHMvbWFzdGVy',\n", |
331 | 333 | " 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/refs/heads/master',\n", |
332 | | - " 'object': {'sha': '3d27c573b7f9bdea704289567603f1d02e7e113b',\n", |
| 334 | + " 'object': {'sha': '17efbb7eb346f0f9161c227af9c8db93597321e2',\n", |
333 | 335 | " 'type': 'commit',\n", |
334 | | - " 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/3d27c573b7f9bdea704289567603f1d02e7e113b'}}" |
| 336 | + " 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/17efbb7eb346f0f9161c227af9c8db93597321e2'}}" |
335 | 337 | ] |
336 | 338 | }, |
337 | 339 | "execution_count": null, |
|
360 | 362 | "\n", |
361 | 363 | "> GhApi.__getitem__ (k)\n", |
362 | 364 | "\n", |
363 | | - "Lookup and call an endpoint by path and verb (which defaults to 'GET')" |
| 365 | + "*Lookup and call an endpoint by path and verb (which defaults to 'GET')*" |
364 | 366 | ], |
365 | 367 | "text/plain": [ |
366 | 368 | "---\n", |
|
371 | 373 | "\n", |
372 | 374 | "> GhApi.__getitem__ (k)\n", |
373 | 375 | "\n", |
374 | | - "Lookup and call an endpoint by path and verb (which defaults to 'GET')" |
| 376 | + "*Lookup and call an endpoint by path and verb (which defaults to 'GET')*" |
375 | 377 | ] |
376 | 378 | }, |
377 | 379 | "execution_count": null, |
|
400 | 402 | "text/markdown": [ |
401 | 403 | "```json\n", |
402 | 404 | "{ 'node_id': 'MDM6UmVmMzE1NzEyNTg4OnJlZnMvaGVhZHMvbWFzdGVy',\n", |
403 | | - " 'object': { 'sha': '3d27c573b7f9bdea704289567603f1d02e7e113b',\n", |
| 405 | + " 'object': { 'sha': '17efbb7eb346f0f9161c227af9c8db93597321e2',\n", |
404 | 406 | " 'type': 'commit',\n", |
405 | | - " 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/3d27c573b7f9bdea704289567603f1d02e7e113b'},\n", |
| 407 | + " 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/17efbb7eb346f0f9161c227af9c8db93597321e2'},\n", |
406 | 408 | " 'ref': 'refs/heads/master',\n", |
407 | 409 | " 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/refs/heads/master'}\n", |
408 | 410 | "```" |
|
411 | 413 | "{'ref': 'refs/heads/master',\n", |
412 | 414 | " 'node_id': 'MDM6UmVmMzE1NzEyNTg4OnJlZnMvaGVhZHMvbWFzdGVy',\n", |
413 | 415 | " 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/refs/heads/master',\n", |
414 | | - " 'object': {'sha': '3d27c573b7f9bdea704289567603f1d02e7e113b',\n", |
| 416 | + " 'object': {'sha': '17efbb7eb346f0f9161c227af9c8db93597321e2',\n", |
415 | 417 | " 'type': 'commit',\n", |
416 | | - " 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/3d27c573b7f9bdea704289567603f1d02e7e113b'}}" |
| 418 | + " 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/17efbb7eb346f0f9161c227af9c8db93597321e2'}}" |
417 | 419 | ] |
418 | 420 | }, |
419 | 421 | "execution_count": null, |
|
1724 | 1726 | ], |
1725 | 1727 | "metadata": { |
1726 | 1728 | "kernelspec": { |
1727 | | - "display_name": "Python 3 (ipykernel)", |
| 1729 | + "display_name": "python3", |
1728 | 1730 | "language": "python", |
1729 | 1731 | "name": "python3" |
1730 | 1732 | } |
|
0 commit comments