|
import asyncio
|
|
from playwright.async_api import async_playwright
|
|
|
|
async def main():
|
|
async with async_playwright() as p:
|
|
|
|
browser = await p.chromium.launch(headless=True)
|
|
context = await browser.new_context()
|
|
page = await context.new_page()
|
|
|
|
|
|
await page.goto('https://shop.cosmo.fans/en/login/landing')
|
|
|
|
|
|
|
|
|
|
wait_for_ticket = page.wait_for_event(
|
|
"response",
|
|
lambda r: 'https://shop.cosmo.fans/bff/v1/users/auth/login/native/qr/ticket' in r.url
|
|
)
|
|
|
|
|
|
await page.get_by_role("button", name="Continue with Cosmo app").click()
|
|
|
|
|
|
response = await wait_for_ticket
|
|
response_body = await response.text()
|
|
print("Response from ticket endpoint:", response_body)
|
|
return response_body
|
|
|
|
|
|
|
|
await browser.close()
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|
|
|