retrieve laboratories data again if the token has been expied.

This commit is contained in:
Yoshihiro OKUMURA 2023-05-08 17:06:53 +09:00
parent fb8dfbef10
commit 06a91de15e
Signed by: orrisroot
GPG Key ID: 470AA444C92904B2

View File

@ -20,7 +20,7 @@ def create_session(remote: str) -> MDRSSession:
def find_laboratory(session: MDRSSession, laboratory_name: str) -> Laboratory:
if session.laboratories.empty():
if session.laboratories.empty() or session.token is not None and session.token.is_expired:
laboratory_api = LaboratoryApi(session)
session.laboratories = laboratory_api.list()
laboratory = session.laboratories.find_by_name(laboratory_name)