Skip to content

Commit

Permalink
fix: specify default when extracting session state
Browse files Browse the repository at this point in the history
From the official python docs: 

get(key[, default])
Return the value for key if key is in the dictionary, else default. If default is not given, it defaults to None, so that this method never raises a KeyError.

Specifying a keyword argument causes an error, at least on my machine. 

Ubuntu 20.04.5
Python 3.9.16

https://docs.python.org/3.10/library/stdtypes.html?highlight=dict%20get#dict.get
  • Loading branch information
ctgallagher4 authored May 31, 2023
1 parent fc8e167 commit c28da44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/flask_cognito_lib/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def wrapper(*args, **kwargs):
# Add suport for custom state values which are appended to a secure
# random value for additional CRSF protection
state = secure_random()
custom_state = session.get("state", default=None)
custom_state = session.get("state")
if custom_state:
state += f"__{custom_state}"

Expand Down

0 comments on commit c28da44

Please sign in to comment.