Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
NPDD
baobaxia-mucua
Commits
330d5eb3
Commit
330d5eb3
authored
1 year ago
by
Saci Pererê
Browse files
Options
Download
Email Patches
Plain Diff
chore: Muda forma de declarar "type OU None"
parent
965b648f
master
feature/midias-multiimages
fer-atualiza-dockerfile
fer-update-docker-readme
fernao-blog-content
fernao-mocambola-content
vince-relacoes
vince-saci-rebase-refactor-mucua-balaio-mocambola
No related merge requests found
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
baobaxia/models/auth.py
+3
-1
baobaxia/models/auth.py
baobaxia/utils/auth.py
+4
-1
baobaxia/utils/auth.py
with
7 additions
and
2 deletions
+7
-2
baobaxia/models/auth.py
View file @
330d5eb3
#!/usr/bin/env python3
from
typing
import
Union
from
pydantic
import
BaseModel
...
...
@@ -8,4 +10,4 @@ class Token(BaseModel):
class
TokenData
(
BaseModel
):
username
:
str
|
None
=
None
username
:
Union
[
str
,
None
]
=
None
This diff is collapsed.
Click to expand it.
baobaxia/utils/auth.py
View file @
330d5eb3
#!/usr/bin/env python3
from
datetime
import
datetime
,
timedelta
,
timezone
from
typing
import
Union
from
fastapi.security
import
OAuth2PasswordBearer
from
jose
import
jwt
...
...
@@ -19,7 +20,9 @@ def get_password_hash(password):
return
pwd_context
.
hash
(
password
)
def
create_access_token
(
data
:
dict
,
expires_delta
:
timedelta
|
None
=
None
):
def
create_access_token
(
data
:
dict
,
expires_delta
:
Union
[
timedelta
,
None
]
=
None
):
to_encode
=
data
.
copy
()
if
expires_delta
:
expire
=
datetime
.
now
(
timezone
.
utc
)
+
expires_delta
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help