Created
April 19, 2024 21:23
-
-
Save Guitaricet/20db41d46bdc0067489de4f30699bfcd to your computer and use it in GitHub Desktop.
Wandb check if logged in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netrc | |
import os | |
def is_wandb_logged_in(): | |
netrc_path = os.path.expanduser("~/.netrc") | |
if not os.path.exists(netrc_path): | |
return False | |
auth = netrc.netrc(netrc_path).authenticators("api.wandb.ai") | |
return bool(auth) | |
# Usage example | |
login_status = is_wandb_logged_in() | |
print("Logged in" if login_status else "Not logged in") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment