Skip to content

Commit 63358af

Browse files
committed
fixes #18
1 parent 241c34e commit 63358af

File tree

13 files changed

+2181
-752
lines changed

13 files changed

+2181
-752
lines changed

00_core.ipynb

Lines changed: 24 additions & 291 deletions
Large diffs are not rendered by default.

02_auth.ipynb

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,15 @@
2525
"source": [
2626
"#export\n",
2727
"from fastcore.utils import *\n",
28-
"from ghapi.core import *\n",
29-
"import webbrowser,time\n",
30-
"\n",
31-
"from urllib.parse import parse_qs"
28+
"from fastcore.foundation import *\n",
29+
"from ghapi.core import *"
30+
]
31+
},
32+
{
33+
"cell_type": "markdown",
34+
"metadata": {},
35+
"source": [
36+
"## Scopes"
3237
]
3338
},
3439
{
@@ -38,7 +43,54 @@
3843
"outputs": [],
3944
"source": [
4045
"#export\n",
41-
"_def_clientid = '771f3c3af93face45f52'"
46+
"_scopes =(\n",
47+
" 'repo','repo:status','repo_deployment','public_repo','repo:invite','security_events','admin:repo_hook','write:repo_hook',\n",
48+
" 'read:repo_hook','admin:org','write:org','read:org','admin:public_key','write:public_key','read:public_key','admin:org_hook',\n",
49+
" 'gist','notifications','user','read:user','user:email','user:follow','delete_repo','write:discussion','read:discussion',\n",
50+
" 'write:packages','read:packages','delete:packages','admin:gpg_key','write:gpg_key','read:gpg_key','workflow'\n",
51+
")"
52+
]
53+
},
54+
{
55+
"cell_type": "code",
56+
"execution_count": null,
57+
"metadata": {},
58+
"outputs": [],
59+
"source": [
60+
"#export\n",
61+
"Scope = AttrDict({o.replace(':','_'):o for o in _scopes})"
62+
]
63+
},
64+
{
65+
"cell_type": "code",
66+
"execution_count": null,
67+
"metadata": {},
68+
"outputs": [],
69+
"source": [
70+
"#export\n",
71+
"def scope_str(*scopes)->str:\n",
72+
" \"Convert `scopes` into a comma-separated string\"\n",
73+
" return ','.join(str(o) for o in scopes if o)"
74+
]
75+
},
76+
{
77+
"cell_type": "code",
78+
"execution_count": null,
79+
"metadata": {},
80+
"outputs": [
81+
{
82+
"data": {
83+
"text/plain": [
84+
"'repo,admin:public_key,public_repo'"
85+
]
86+
},
87+
"execution_count": null,
88+
"metadata": {},
89+
"output_type": "execute_result"
90+
}
91+
],
92+
"source": [
93+
"scope_str(Scope.repo,Scope.admin_public_key,Scope.public_repo)"
4294
]
4395
},
4496
{
@@ -48,6 +100,16 @@
48100
"## GhDeviceAuth -"
49101
]
50102
},
103+
{
104+
"cell_type": "code",
105+
"execution_count": null,
106+
"metadata": {},
107+
"outputs": [],
108+
"source": [
109+
"#export\n",
110+
"_def_clientid = '771f3c3af93face45f52'"
111+
]
112+
},
51113
{
52114
"cell_type": "code",
53115
"execution_count": null,

0 commit comments

Comments
 (0)