Download sync_dynamics.py from isold/MeloonTop: direct link, hf CLI and curl.
- Browser
- Download file 751 Bytes
-
https://huggingface.co/spaces/isold/MeloonTop/resolve/main/sync_dynamics.py
- Command line
-
hf download hf://spaces/isold/MeloonTop/sync_dynamics.py
-
curl -L -o sync_dynamics.py https://huggingface.co/spaces/isold/MeloonTop/resolve/main/sync_dynamics.py
751 Bytes
| import httpx | |
| import asyncio | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| BASE_URL = os.getenv("API_BASE_URL", "http://127.0.0.1:8000") | |
| async def sync_dynamics(): | |
| print(f"Starting sync from {BASE_URL}/api/dynamics/sync ...") | |
| async with httpx.AsyncClient(timeout=60.0) as client: | |
| try: | |
| response = await client.post(f"{BASE_URL}/api/dynamics/sync") | |
| if response.status_code == 200: | |
| print(f"Sync successful: {response.json().get('message')}") | |
| else: | |
| print(f"Sync failed with status {response.status_code}: {response.text}") | |
| except Exception as e: | |
| print(f"Error during sync: {e}") | |
| if __name__ == "__main__": | |
| asyncio.run(sync_dynamics()) | |