Datasets:
Translation-resource audit of 325 FineWiki languages (finewiki_audit_20261114T182048Z)
aaee816 verified Download scripts/hf_publishing_auth.py from sigiranic/language-status: direct link, hf CLI and curl.
- Browser
- Download file 806 Bytes
-
https://huggingface.co/datasets/sigiranic/language-status/resolve/main/scripts/hf_publishing_auth.py
- Command line
-
hf download hf://datasets/sigiranic/language-status/scripts/hf_publishing_auth.py
-
curl -L -o hf_publishing_auth.py https://huggingface.co/datasets/sigiranic/language-status/resolve/main/scripts/hf_publishing_auth.py
806 Bytes
| """Local-only credential lookup; this module is never included in a Hub release.""" | |
| import os | |
| import re | |
| import subprocess | |
| import sys | |
| KEYCHAIN_SERVICE = "gilaki-huggingface-project" | |
| KEYCHAIN_ACCOUNT = "sigiranic-gilaki-publishing" | |
| def publishing_token(): | |
| token = os.environ.get("HF_TOKEN", "").strip() | |
| if not token and sys.platform == "darwin": | |
| result = subprocess.run(["security", "find-generic-password", "-s", KEYCHAIN_SERVICE, | |
| "-a", KEYCHAIN_ACCOUNT, "-w"], text=True, capture_output=True) | |
| if result.returncode == 0: | |
| token = result.stdout.rstrip("\n") | |
| if not re.fullmatch(r"hf_[A-Za-z0-9]{20,}", token): | |
| raise RuntimeError("No valid project credential found in HF_TOKEN or the project Keychain entry") | |
| return token | |