我正在制作一个Python脚本,通过剧作家网络驱动程序请求用户提供cookie
这是我的伪代码
import asyncio
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as playwright:
browser = await playwright.chromium.launch(headless=False)
context = await browser.new_context()
page = await context.new_page()
await page.goto('https://example.com')
print('Please log-in')
while True:
for i in (await context.cookies()):
if i['name'] == 'account_cookie':
return i['value']
asyncio.run(main())