sfp / api_test.py
Forgets's picture
Create api_test.py
ed1b19a verified
import asyncio
import httpx
async def main():
# Gunakan timeout yang cukup lama karena Puppeteer butuh waktu untuk bypass
# Jika di lokal/server, sesuaikan URL-nya
base_url = "http://localhost:7860"
limits = httpx.Limits(max_keepalive_connections=5, max_connections=10)
async with httpx.AsyncClient(timeout=120.0, limits=limits) as client:
print("--- Testing Mode: IUAM ---")
try:
resp1 = await client.post(
f"{base_url}/cloudflare",
json={
"domain": "https://olamovies.watch/generate",
"mode": "iuam",
},
)
# Menggunakan .get() agar tidak error jika respon bukan JSON
print(resp1.status_code, resp1.json())
except Exception as e:
print(f"Error pada IUAM: {e}")
print("\n--- Testing Mode: Turnstile ---")
try:
resp2 = await client.post(
f"{base_url}/cloudflare",
json={
"domain": "https://lksfy.com/",
"siteKey": "0x4AAAAAAA49NnPZwQijgRoi",
"mode": "turnstile",
},
)
print(resp2.status_code, resp2.json())
except Exception as e:
print(f"Error pada Turnstile: {e}")
if __name__ == "__main__":
asyncio.run(main())