screenshot-to-code/backend/routes/saas_utils.py
2024-01-05 06:13:58 -08:00

24 lines
684 B
Python

import httpx
from pydantic import BaseModel
class SubscriptionCreditsResponse(BaseModel):
status: str
async def does_user_have_subscription_credits(
auth_token: str,
):
async with httpx.AsyncClient() as client:
url = "https://screenshot-to-code-saas.onrender.com/credits/has_credits"
# url = "http://localhost:8001/credits/has_credits"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {auth_token}",
}
response = await client.post(url, headers=headers, timeout=60)
parsed_response = SubscriptionCreditsResponse.parse_obj(response.json())
return parsed_response