|
25 | 25 | "source": [ |
26 | 26 | "#export\n", |
27 | 27 | "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" |
32 | 37 | ] |
33 | 38 | }, |
34 | 39 | { |
|
38 | 43 | "outputs": [], |
39 | 44 | "source": [ |
40 | 45 | "#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)" |
42 | 94 | ] |
43 | 95 | }, |
44 | 96 | { |
|
48 | 100 | "## GhDeviceAuth -" |
49 | 101 | ] |
50 | 102 | }, |
| 103 | + { |
| 104 | + "cell_type": "code", |
| 105 | + "execution_count": null, |
| 106 | + "metadata": {}, |
| 107 | + "outputs": [], |
| 108 | + "source": [ |
| 109 | + "#export\n", |
| 110 | + "_def_clientid = '771f3c3af93face45f52'" |
| 111 | + ] |
| 112 | + }, |
51 | 113 | { |
52 | 114 | "cell_type": "code", |
53 | 115 | "execution_count": null, |
|
0 commit comments