Spaces:
Sleeping
Sleeping
Download keep-alive.py from arpy8/universal-bot-application: direct link, hf CLI and curl.
- Browser
- Download file 610 Bytes
-
https://huggingface.co/spaces/arpy8/universal-bot-application/resolve/main/keep-alive.py
- Command line
-
hf download hf://spaces/arpy8/universal-bot-application/keep-alive.py
-
curl -L -o keep-alive.py https://huggingface.co/spaces/arpy8/universal-bot-application/resolve/main/keep-alive.py
610 Bytes
| import os | |
| import requests | |
| AUTH_TOKEN = os.environ["AUTH_TOKEN"] | |
| def main(): | |
| print(AUTH_TOKEN) | |
| response = requests.get( | |
| url="https://universal-api.onrender.com/", | |
| headers={ | |
| "Authorization": AUTH_TOKEN | |
| } | |
| ) | |
| if response.status_code == 200: | |
| try: | |
| note = response.json()["NOTE"] | |
| print(note) | |
| except requests.exceptions.JSONDecodeError: | |
| print("Error: Unable to decode JSON from the response.") | |
| else: | |
| print(f"Error: {response.status_code}, {response.text}") | |
| if __name__ == "__main__": | |
| main() |