Create test_token.py
Browse files- test_token.py +11 -0
test_token.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from huggingface_hub import whoami
|
| 3 |
+
|
| 4 |
+
token = os.getenv("HF_TOKEN")
|
| 5 |
+
print(f"Token exists: {token is not None}")
|
| 6 |
+
if token:
|
| 7 |
+
try:
|
| 8 |
+
user_info = whoami(token)
|
| 9 |
+
print(f"Token works! User: {user_info}")
|
| 10 |
+
except Exception as e:
|
| 11 |
+
print(f"Token error: {e}")
|