Skip to content

Commit

Permalink
parse_env
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 committed Jun 2, 2024
1 parent 3e7b0a2 commit 5735854
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
3 changes: 3 additions & 0 deletions examples/gh_secret.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
client_id="XXX"
client_secret="XXX"

1 change: 0 additions & 1 deletion examples/gh_secret.json

This file was deleted.

1 change: 1 addition & 0 deletions fasthtml/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from fastcore.utils import *
from fastcore.net import recv_once
from fastcore.xtras import parse_env

from oauthlib.oauth2 import WebApplicationClient
from urllib.parse import urlparse, parse_qs
Expand Down
8 changes: 4 additions & 4 deletions nbs/03_oauth.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"\n",
"from fastcore.utils import *\n",
"from fastcore.net import recv_once\n",
"from fastcore.xtras import parse_env\n",
"\n",
"from oauthlib.oauth2 import WebApplicationClient\n",
"from urllib.parse import urlparse, parse_qs"
Expand All @@ -55,10 +56,9 @@
"metadata": {},
"outputs": [],
"source": [
"fn = 'gh_secret.json'\n",
"# fn = 'client_secret.json'\n",
"# secrets = Path(f'../examples/{fn}').read_json()\n",
"secrets = (Path.home()/f'git/nbs/oauth-test/{fn}').read_json()\n",
"ex_path = Path(f'../examples')\n",
"# secrets = (ex_path/'goog_secret.json').read_json()\n",
"secrets = parse_env(fn=ex_path/'gh_secret.env')\n",
"host,port = 'localhost',8000\n",
"redirect_uri = f\"http://{host}:{port}/redirect\""
]
Expand Down
3 changes: 1 addition & 2 deletions nbs/core_tests.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@
}
],
"source": [
"class MyDict(TypedDict):\n",
" name: str\n",
"class MyDict(TypedDict): name:str\n",
"\n",
"is_typeddict(MyDict)"
]
Expand Down

0 comments on commit 5735854

Please sign in to comment.