-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Group Attributes of Class and Object elements of Google Wallet, to make it more maintainable. #6
base: main
Are you sure you want to change the base?
Conversation
…ke it more maintainable.
) | ||
if path.exists(): | ||
self._credentials_file = path | ||
return self._credentials_file | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has to be documented.
src/edutap/wallet_google/api.py
Outdated
@@ -394,9 +400,9 @@ def save_link( | |||
} | |||
signer = crypt.RSASigner.from_service_account_file(session_manager.credentials_file) | |||
jwt_string = jwt.encode(signer, claims).decode("utf-8") | |||
logger.debug( | |||
"JWT-Length: %d, is less than recommenden 1800: %s", | |||
logger.warning( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this is worth a warning. It works anyway if it is longer.
This needs also:
|
…on back to model_dump(mode='json') in API.
src/edutap/wallet_google/api.py
Outdated
@@ -170,6 +170,8 @@ def update( | |||
url=session_manager.url(name, f"/{resource_id}"), | |||
data=verified_json.encode("utf-8"), | |||
) | |||
logger.debug(verified_json.encode("utf-8")) | |||
# print(verified_json.encode("utf-8")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commented print should go before merge.
@@ -12,7 +12,7 @@ class GoogleWalletModel(BaseModel): | |||
""" | |||
|
|||
model_config = ConfigDict( | |||
# extra="forbid", | |||
extra="forbid", | |||
# extra="ignore", | |||
# use_enum_values=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am pretty sure we want to use_enum_values to be true on serialization
@simon-lund please make a detailed review and if possible also make additional commits. This Pull-Request changes the default behavior of eduTAP.wallet_google only to accept model attributes to be set if they are explicitly in the model. This follows PEP 20 Zen of Python: explicit is better than implicit Each model element should have a reference to its documentation and all relevant attributes. |
Co-authored-by: Jens W. Klein <jk@kleinundpartner.at>
Co-authored-by: Jens W. Klein <jk@kleinundpartner.at>
Before merging, a PR to update https://github.com/edutap-eu/documentation/tree/main/source/packages/edutap_wallet_google is needed over there. |
Group Attributes of Class and Object elements of Google Wallet to make it mor maintainable.