thp / urlwatch

Watch (parts of) webpages and get notified when something changes via e-mail, on your phone or via other means. Highly configurable.
https://thp.io/2008/urlwatch/
Other
2.81k stars 352 forks source link

Update asyncio coroutine syntax to Python 3.11+ #759

Closed fasterit closed 1 year ago

fasterit commented 1 year ago

Cf. https://bugs.python.org/issue43216

Resolves the error when using the browser job type in Python 3.11.x:

Traceback (most recent call last): File "/[..]/lib/python3.11/site-packages/urlwatch/handler.py", line 68, in enter self.job.main_thread_enter() File "/[..]/lib/python3.11/site-packages/urlwatch/jobs.py", line 418, in main_thread_enter from .browser import BrowserContext File "/[..]/lib/python3.11/site-packages/urlwatch/browser.py", line 50 browser = yield from pyppeteer.launch() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: 'yield from' inside async function

Also adds --no-sandbox as a default to the pyppeteer chromium invocation.

/DLange

thp commented 1 year ago

Thanks! However, this might become obsolete with #761?

fasterit commented 1 year ago

If you want to fully migrate to playwright, yes. That PR did not exist three days ago :-) Greets, /DLange

thp commented 1 year ago

I'm still going to merge this, since we require Python >= 3.7, and people who don't want to migrate to Playwright might find this useful. After merging this, I'm looking at the Playwright change next.

thp commented 1 year ago

This is now in urlwatch 2.27, and urlwatch 2.28 migrates to Playwright, so users wanting to use pyppeteer for some reason can stick to 2.27 for now, and use Python 3.11.