login#
- rapidtools.auth.login(token: str | None = None, dataset_id: str = 'hf_token') bool[source]#
Authenticate this machine with the Hugging Face Hub.
Resolution order: an explicit
token, a token already cached byhuggingface-cli login, then the token file published in the rapidtools dataset registry (downloaded, used, and deleted).- Parameters:
token – Hugging Face access token. When given it is cached for future sessions.
dataset_id – Registry entry holding the fallback token file.
- Returns:
bool –
Truewhen a token is available afterwards,Falsewhen every source failed (the failure is logged, never raised).
Example
>>> from rapidtools.auth import login >>> login(token='hf_example') True