Update generator.py
Browse files- generator.py +11 -1
generator.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import asyncio
|
2 |
from playwright.async_api import async_playwright
|
3 |
import logging
|
|
|
4 |
|
5 |
# Setup the logging
|
6 |
logging.basicConfig(level=logging.INFO, format='%(message)s')
|
@@ -98,5 +99,14 @@ async def run():
|
|
98 |
break
|
99 |
|
100 |
await browser.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
-
asyncio.run(run())
|
|
|
1 |
import asyncio
|
2 |
from playwright.async_api import async_playwright
|
3 |
import logging
|
4 |
+
import time
|
5 |
|
6 |
# Setup the logging
|
7 |
logging.basicConfig(level=logging.INFO, format='%(message)s')
|
|
|
99 |
break
|
100 |
|
101 |
await browser.close()
|
102 |
+
while True:
|
103 |
+
try:
|
104 |
+
# your existing code here
|
105 |
+
asyncio.run(run())
|
106 |
+
except Exception as e:
|
107 |
+
logging.error(f"An error occurred: {e}")
|
108 |
+
finally:
|
109 |
+
# sleep for 10 minutes
|
110 |
+
time.sleep(5 * 60)
|
111 |
+
|
112 |
|
|