weatherhack-api / check_keys.py
Ig0tU
feat: complete air quality integration, remove moon phase, and secure api keys
6f5bf7c
import httpx
import asyncio
BASE_URL = "http://localhost:8000"
async def check_keys():
async with httpx.AsyncClient() as client:
# Try 'test'
print("Testing access_key=test...")
res = await client.get(f"{BASE_URL}/current?access_key=test&query=New York")
print(f"Status for 'test': {res.status_code}")
if res.status_code == 200:
print("WARNING: 'test' key still works!")
else:
print("SUCCESS: 'test' key rejected.")
# Try the real key
real_key = "b55a6ab9aec1ab156c0b46f0a9ef93dd"
print(f"\nTesting access_key={real_key}...")
res = await client.get(
f"{BASE_URL}/current?access_key={real_key}&query=New York"
)
print(f"Status for real key: {res.status_code}")
if res.status_code == 200:
print("SUCCESS: Real key works.")
else:
print(f"FAILURE: Real key rejected. Body: {res.text}")
if __name__ == "__main__":
asyncio.run(check_keys())