Add user agent to UberEatsBot

This commit is contained in:
AlberLC
2023-03-08 02:15:09 +01:00
parent 34320079eb
commit 55e3fe53c2

View File

@@ -55,9 +55,11 @@ class UberEatsBot(MultiBot, ABC):
for i, cookies in enumerate(chat.ubereats['cookies']):
for _ in range(3):
try:
self.task_contexts[chat.id]['browser'] = await self.task_contexts[chat.id]['playwright'].chromium.launch()
context: playwright.async_api.BrowserContext = await self.task_contexts[chat.id]['browser'].new_context()
await context.add_cookies(cookies)
self.task_contexts[chat.id]['browser'] = await self.task_contexts[chat.id]['playwright'].chromium.launch(headless=False)
context: playwright.async_api.BrowserContext = await self.task_contexts[chat.id]['browser'].new_context(
storageState={'cookies': cookies},
user_agent=flanautils.USER_AGENT
)
page = await context.new_page()
await page.goto('https://www.myunidays.com/ES/es-ES/partners/ubereats/access/online')