Spaces:
Paused
Paused
Download test_owner.py from chandrakiran06/rosdiff: direct link, hf CLI and curl.
- Browser
- Download file 568 Bytes
-
https://huggingface.co/spaces/chandrakiran06/rosdiff/resolve/main/test_owner.py
- Command line
-
hf download hf://spaces/chandrakiran06/rosdiff/test_owner.py
-
curl -L -o test_owner.py https://huggingface.co/spaces/chandrakiran06/rosdiff/resolve/main/test_owner.py
568 Bytes
| import sys | |
| import os | |
| import requests | |
| from fastapi.testclient import TestClient | |
| # Make sure we load the env file | |
| from dotenv import load_dotenv | |
| load_dotenv('.env') | |
| # Add to path so we can import api | |
| sys.path.insert(0, os.getcwd()) | |
| from api.main import app | |
| client = TestClient(app) | |
| print("Testing with owner key: " + os.environ["OWNER_API_KEY"]) | |
| response = client.get("/me/usage", headers={"X-API-Key": os.environ["OWNER_API_KEY"]}) | |
| print("\nResponse Status:", response.status_code) | |
| import json | |
| print("\nResponse Body:") | |
| print(json.dumps(response.json(), indent=2)) | |