Skip to content

Instantly share code, notes, and snippets.

@Guitaricet
Created April 19, 2024 21:23
Show Gist options
  • Save Guitaricet/20db41d46bdc0067489de4f30699bfcd to your computer and use it in GitHub Desktop.
Save Guitaricet/20db41d46bdc0067489de4f30699bfcd to your computer and use it in GitHub Desktop.
Wandb check if logged in
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