Download sync_secrets.py from AhmedShahan/JobSathi_Backend: direct link, hf CLI and curl.
- Browser
- Download file 692 Bytes
-
https://huggingface.co/spaces/AhmedShahan/JobSathi_Backend/resolve/main/sync_secrets.py
- Command line
-
hf download hf://spaces/AhmedShahan/JobSathi_Backend/sync_secrets.py
-
curl -L -o sync_secrets.py https://huggingface.co/spaces/AhmedShahan/JobSathi_Backend/resolve/main/sync_secrets.py
692 Bytes
| import os | |
| from huggingface_hub import HfApi | |
| SPACE_ID = "AhmedShahan/JobSathi_Backend" | |
| ENV_FILE = ".env" | |
| def main(): | |
| token = os.environ["HF_TOKEN"] | |
| api = HfApi(token=token) | |
| with open(ENV_FILE, "r") as f: | |
| for line in f: | |
| line = line.strip() | |
| if not line or line.startswith("#") or "=" not in line: | |
| continue | |
| key, value = line.split("=", 1) | |
| key = key.strip() | |
| value = value.strip().strip('"').strip("'") | |
| if not key: | |
| continue | |
| api.add_space_secret(repo_id=SPACE_ID, key=key, value=value) | |
| print(f"Synced: {key}") | |
| if __name__ == "__main__": | |
| main() |