cosmo/clear_cache.py

15 lines
443 B
Python

import requests
def clear_cache():
url = "http://localhost:8000/api/system/cache/clear"
try:
response = requests.post(url, timeout=5)
print(f"Status: {response.status_code}")
print(f"Body: {response.text}")
response.raise_for_status()
print(f"Cache cleared: {response.json()}")
except Exception as e:
print(f"Error clearing cache: {e}")
if __name__ == "__main__":
clear_cache()