Skip to content
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

Added is_initialised function. Fixes #46. #49

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions meorg_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,3 +419,22 @@ def success(self) -> bool:
True if successful, False otherwise.
"""
return self.last_response.status_code in mcc.HTTP_STATUS_SUCCESS_RANGE

def is_initialised(self, dev=False) -> bool:
"""Check if the client is initialised.

NOTE: This does not check the login actually works.

Parameters
----------
dev : bool, optional
Use dev credentials, by default False

Returns
-------
bool
True if initialised, False otherwise.
"""
cred_filename = "credentials.json" if not dev else "credentials-dev.json"
cred_filepath = mu.get_user_data_filepath(cred_filename)
return cred_filepath.exists()
Loading