add secret to access the backend

This commit is contained in:
Abi Raja 2023-11-29 14:00:45 -05:00
parent 7889e0c3d5
commit b904710cfc

View File

@ -1,11 +1,17 @@
import json
import os
import httpx
async def validate_access_token(access_code: str):
async with httpx.AsyncClient() as client:
url = "http://localhost:8000/screenshot_to_code/validate_access_token"
data = json.dumps({"access_code": access_code})
data = json.dumps(
{
"access_code": access_code,
"secret": os.environ.get("PICO_BACKEND_SECRET"),
}
)
headers = {"Content-Type": "application/json"}
response = await client.post(url, content=data, headers=headers)