WPP_Whatsapp aim of exporting functions from WhatsApp Web to the python, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination
When I restart, it throws an error shortly afterward, but it does not affect the browser's ability to continue functioning after the restart.
Traceback (most recent call last):
File "C:\Users\Jeck\anaconda3\envs\LeboncoinMeaasge\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\Jeck\anaconda3\envs\LeboncoinMeaasge\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Jeck\PycharmProjects\watermarking-app\WPP_Whatsapp\controllers\initializer.py", line 82, in _onStateChange
connected = self.ThreadsafeBrowser.sync_page_evaluate("() => WPP.conn.isRegistered()")
File "C:\Users\Jeck\PycharmProjects\watermarking-app\WPP_Whatsapp\PlaywrightSafeThread\browser\threadsafe_browser.py", line 353, in sync_page_evaluate
return self.run_threadsafe(self.page.evaluate, expression, arg, timeout_=timeout_)
File "C:\Users\Jeck\PycharmProjects\watermarking-app\WPP_Whatsapp\PlaywrightSafeThread\browser\threadsafe_browser.py", line 404, in run_threadsafe
result = future.result(timeout=timeout_)
File "C:\Users\Jeck\anaconda3\envs\LeboncoinMeaasge\lib\concurrent\futures\_base.py", line 446, in result
raise TimeoutError()
concurrent.futures._base.TimeoutError
Exception in thread Thread-13:
Traceback (most recent call last):
File "C:\Users\Jeck\anaconda3\envs\LeboncoinMeaasge\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\Jeck\anaconda3\envs\LeboncoinMeaasge\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Jeck\PycharmProjects\watermarking-app\WPP_Whatsapp\controllers\initializer.py", line 82, in _onStateChange
connected = self.ThreadsafeBrowser.sync_page_evaluate("() => WPP.conn.isRegistered()")
File "C:\Users\Jeck\PycharmProjects\watermarking-app\WPP_Whatsapp\PlaywrightSafeThread\browser\threadsafe_browser.py", line 353, in sync_page_evaluate
return self.run_threadsafe(self.page.evaluate, expression, arg, timeout_=timeout_)
File "C:\Users\Jeck\PycharmProjects\watermarking-app\WPP_Whatsapp\PlaywrightSafeThread\browser\threadsafe_browser.py", line 404, in run_threadsafe
result = future.result(timeout=timeout_)
File "C:\Users\Jeck\anaconda3\envs\LeboncoinMeaasge\lib\concurrent\futures\_base.py", line 446, in result
raise TimeoutError()
concurrent.futures._base.TimeoutError
Exception in thread Exception in thread Thread-15:
Traceback (most recent call last):
File "C:\Users\Jeck\anaconda3\envs\LeboncoinMeaasge\lib\threading.py", line 932, in _bootstrap_inner
Thread-14:
Traceback (most recent call last):
File "C:\Users\Jeck\anaconda3\envs\LeboncoinMeaasge\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\Jeck\anaconda3\envs\LeboncoinMeaasge\lib\threading.py", line 870, in run
self.run()
File "C:\Users\Jeck\anaconda3\envs\LeboncoinMeaasge\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Jeck\PycharmProjects\watermarking-app\WPP_Whatsapp\controllers\initializer.py", line 82, in _onStateChange
self._target(*self._args, **self._kwargs)
File "C:\Users\Jeck\PycharmProjects\watermarking-app\WPP_Whatsapp\controllers\initializer.py", line 82, in _onStateChange
connected = self.ThreadsafeBrowser.sync_page_evaluate("() => WPP.conn.isRegistered()")
File "C:\Users\Jeck\PycharmProjects\watermarking-app\WPP_Whatsapp\PlaywrightSafeThread\browser\threadsafe_browser.py", line 353, in sync_page_evaluate
connected = self.ThreadsafeBrowser.sync_page_evaluate("() => WPP.conn.isRegistered()")
File "C:\Users\Jeck\PycharmProjects\watermarking-app\WPP_Whatsapp\PlaywrightSafeThread\browser\threadsafe_browser.py", line 353, in sync_page_evaluate
return self.run_threadsafe(self.page.evaluate, expression, arg, timeout_=timeout_)
File "C:\Users\Jeck\PycharmProjects\watermarking-app\WPP_Whatsapp\PlaywrightSafeThread\browser\threadsafe_browser.py", line 404, in run_threadsafe
return self.run_threadsafe(self.page.evaluate, expression, arg, timeout_=timeout_)
File "C:\Users\Jeck\PycharmProjects\watermarking-app\WPP_Whatsapp\PlaywrightSafeThread\browser\threadsafe_browser.py", line 404, in run_threadsafe
result = future.result(timeout=timeout_)
result = future.result(timeout=timeout_)
File "C:\Users\Jeck\anaconda3\envs\LeboncoinMeaasge\lib\concurrent\futures\_base.py", line 446, in result
File "C:\Users\Jeck\anaconda3\envs\LeboncoinMeaasge\lib\concurrent\futures\_base.py", line 446, in result
raise TimeoutError()
concurrent.futures._base.TimeoutError
raise TimeoutError()
concurrent.futures._base.TimeoutError
While executing self.creator.close(), a warning was logged:
2024-02-28 16:07:37,238 - py.warnings - WARNING - C:\Users\Jeck\PycharmProjects\watermarking-app\sendmain.py:209: RuntimeWarning: coroutine 'Create.close' was never awaited
self.creator.close()
This warning indicates that the Create.close coroutine was called but not awaited, which is required for coroutine functions in Python's asyncio library. To fix this warning, you need to await the coroutine:
self.creator.close()
After this change, you would also need to ensure that creator_close is called within an asynchronous context.
I've defined a SetWhatsApp class that contains two methods:
In the main program, I implemented the start and restart functions:
When I restart, it throws an error shortly afterward, but it does not affect the browser's ability to continue functioning after the restart.
While executing self.creator.close(), a warning was logged:
This warning indicates that the Create.close coroutine was called but not awaited, which is required for coroutine functions in Python's asyncio library. To fix this warning, you need to await the coroutine:
After this change, you would also need to ensure that creator_close is called within an asynchronous context.