Spaces:
Sleeping
Sleeping
Download test_otp_api_complete.py from baljot07/studiq-backend: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/baljot07/studiq-backend/resolve/main/test_otp_api_complete.py
- Command line
-
hf download hf://spaces/baljot07/studiq-backend/test_otp_api_complete.py
-
curl -L -o test_otp_api_complete.py https://huggingface.co/spaces/baljot07/studiq-backend/resolve/main/test_otp_api_complete.py
1.07 kB
| import httpx | |
| import asyncio | |
| async def test_email_otp(): | |
| send_url = "http://localhost:8000/api/v1/auth/otp/email/send" | |
| verify_url = "http://localhost:8000/api/v1/auth/otp/email/verify" | |
| email = "test_user_antigravity@studiq.app" | |
| print(f"Sending request to send OTP to {email}...") | |
| async with httpx.AsyncClient() as client: | |
| try: | |
| resp = await client.post(send_url, json={"email": email}, timeout=20.0) | |
| print(f"Send OTP Status Code: {resp.status_code}") | |
| print(f"Send OTP Response: {resp.text}") | |
| if resp.status_code == 200: | |
| print("\nVerifying OTP with code '123456'...") | |
| resp_verify = await client.post(verify_url, json={"email": email, "otp": "123456"}, timeout=20.0) | |
| print(f"Verify OTP Status Code: {resp_verify.status_code}") | |
| print(f"Verify OTP Response: {resp_verify.text}") | |
| except Exception as e: | |
| print(f"Request failed: {e}") | |
| if __name__ == "__main__": | |
| asyncio.run(test_email_otp()) | |