import requests
response = requests.get(
"https://appkittie.com/api/v1/apps",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"limit": 10},
)
if response.status_code == 200:
data = response.json()
print(f"Found {len(data['data'])} apps")
elif response.status_code == 401:
print("Invalid API key. Check your credentials.")
elif response.status_code == 402:
remaining = response.headers.get("X-Credits-Remaining", "0")
print(f"Insufficient credits. Remaining: {remaining}")
elif response.status_code == 429:
reset = response.headers.get("X-RateLimit-Reset")
print(f"Rate limited. Retry after timestamp: {reset}")
else:
error = response.json().get("error", "Unknown error")
print(f"Error {response.status_code}: {error}")