Download scripts/testing/smoke_test.py from anaselamr/yaz: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/spaces/anaselamr/yaz/resolve/main/scripts/testing/smoke_test.py
- Command line
-
hf download hf://spaces/anaselamr/yaz/scripts/testing/smoke_test.py
-
curl -L -o smoke_test.py https://huggingface.co/spaces/anaselamr/yaz/resolve/main/scripts/testing/smoke_test.py
1.09 kB
| import urllib.request | |
| import urllib.error | |
| def get(url): | |
| try: | |
| r = urllib.request.urlopen(url, timeout=5) | |
| return r.status, r.read().decode() | |
| except urllib.error.HTTPError as e: | |
| return e.code, e.read().decode()[:400] | |
| except Exception as e: | |
| return str(e), '' | |
| tests = [ | |
| ('Admin review UI page', 'http://localhost:8000/admin/intelligence-review'), | |
| ('Admin review API', 'http://localhost:8000/api/v1/admin/intelligence-review'), | |
| ('Creator studio earnings', 'http://localhost:8000/api/v1/creator-studio/earnings'), | |
| ('Creator studio stats', 'http://localhost:8000/api/v1/creator-studio/stats'), | |
| ('Cases search HTMX', 'http://localhost:8000/cases/search?status=active'), | |
| ] | |
| for name, url in tests: | |
| status, body = get(url) | |
| ok = status in (200, 201) | |
| auth = status in (401, 403) | |
| mark = 'OK' if ok else ('AUTH' if auth else 'FAIL') | |
| if ok and 'review' in url.lower() and 'api' in url.lower(): | |
| print(f'{mark} [{status}] {name}: {body[:180]}') | |
| else: | |
| print(f'{mark} [{status}] {name}') | |