mukulhase / WebWhatsapp-Wrapper

An API for sending and receiving messages over web.whatsapp [Working as of 18th May 2018]
https://webwhatsapi.readthedocs.io/en/latest/
MIT License
2.03k stars 796 forks source link

send_message API stop working #384

Open BirendraSahu opened 6 years ago

BirendraSahu commented 6 years ago

Hi, The contact.chat.send_message(default1) API did not responding. The bot will hang when send_message request have made. Please check the Traceback. Please help me

Traceback (most recent call last): File "D:\test\test.py", line 135, in contact.chat.send_message(default1) File "C:\Program Files (x86)\Python36-32\lib\site-packages\webwhatsapi\objects\whatsapp_object.py", line 18, in wrapped return func(self, *args) File "C:\Program Files (x86)\Python36-32\lib\site-packages\webwhatsapi\objects\chat.py", line 28, in send_message return self.driver.chat_send_message(self.id, message) File "C:\Program Files (x86)\Python36-32\lib\site-packages\webwhatsapi__init.py", line 509, in chat_send_message result = self.wapi_functions.sendMessage(chat_id, message) File "C:\Program Files (x86)\Python36-32\lib\site-packages\webwhatsapi\wapi_js_wrapper.py", line 102, in call__ return self.driver.execute_async_script(command) File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 652, in execute_async_script 'args': converted_args})['value'] File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute response = self.command_executor.execute(driver_command, params) File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 472, in execute return self._request(command_info[0], url, body=data) File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 496, in _request resp = self._conn.getresponse() File "C:\Program Files (x86)\Python36-32\lib\http\client.py", line 1331, in getresponse response.begin() File "C:\Program Files (x86)\Python36-32\lib\http\client.py", line 297, in begin version, status, reason = self._read_status() File "C:\Program Files (x86)\Python36-32\lib\http\client.py", line 258, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "C:\Program Files (x86)\Python36-32\lib\socket.py", line 586, in readinto return self._sock.recv_into(b) KeyboardInterrupt

brunosoaresds commented 6 years ago

Please, see #379 and #380

BirendraSahu commented 6 years ago

I have copied the latest webwhatsapi folder with all the changes. But still same issue. Please help me Waiting for QR Bot started Checking for more messages Checking for more messages Checking for more messages Checking for more messages Traceback (most recent call last): File "C:\Program Files (x86)\Python36-32\lib\socket.py", line 586, in readinto return self._sock.recv_into(b) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\FirstHive-Docs\test1.py", line 17, in contact.chat.send_message(message.content) File "C:\Program Files (x86)\Python36-32\lib\site-packages\webwhatsapi\objects\whatsapp_object.py", line 18, in wrapped return func(self, *args) File "C:\Program Files (x86)\Python36-32\lib\site-packages\webwhatsapi\objects\chat.py", line 28, in send_message return self.driver.chat_send_message(self.id, message) File "C:\Program Files (x86)\Python36-32\lib\site-packages\webwhatsapi__init.py", line 509, in chat_send_message result = self.wapi_functions.sendMessage(chat_id, message) File "C:\Program Files (x86)\Python36-32\lib\site-packages\webwhatsapi\wapi_js_wrapper.py", line 102, in call__ return self.driver.execute_async_script(command) File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 652, in execute_async_script 'args': converted_args})['value'] File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute response = self.command_executor.execute(driver_command, params) File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 472, in execute return self._request(command_info[0], url, body=data) File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 496, in _request resp = self._conn.getresponse() File "C:\Program Files (x86)\Python36-32\lib\http\client.py", line 1331, in getresponse response.begin() File "C:\Program Files (x86)\Python36-32\lib\http\client.py", line 297, in begin version, status, reason = self._read_status() File "C:\Program Files (x86)\Python36-32\lib\http\client.py", line 258, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "C:\Program Files (x86)\Python36-32\lib\socket.py", line 586, in readinto return self._sock.recv_into(b) KeyboardInterrupt

brunosoaresds commented 6 years ago

Do you have applied the full patch in #380? The PR is not accepted yet, so you need to apply it manually or get the code from the @GeovRodri fork.

BirendraSahu commented 6 years ago

Did below code need to be added in wapi.js

In window.WAPI.getChat = function (id, done) { add: id = typeof id == "string" ? id : id._serialized;

brunosoaresds commented 6 years ago

The Patch in PR contains that modification too. Just open the #380, go to changes tab e apply the patch.

BirendraSahu commented 6 years ago

I have applied the full patch as listed but still same error https://github.com/mukulhase/WebWhatsapp-Wrapper/pull/380/files

BirendraSahu commented 6 years ago

Thanks. It is working fine now. Thanks a lot

Elintondm commented 6 years ago

Hi,

How to use this patch? How to apply?

Elintondm commented 6 years ago

Please how to download this patch?

lfdelphino commented 6 years ago

@Elintondm What OS and Python version are you using? Basically you could reinstall the whole package to get the latest version of everything.

If you are using windows:

  1. Download everything as ZIP from the main page of this repository (green button "Clone or Download")
  2. Extract it anywhere
  3. Open a command prompt and navigate to the extracted folder
  4. Run: python setup.py install, on MacOS and Linux add sudo in front of it

This should be enough, or you can also just copy the latest content of the files directly to your python folder, on Python 2.7 the path is C:\Python27\Lib\site-packages\webwhatsapi-2.0.3-py2.7.egg\webwhatsapi

andersondeoliveiramachado commented 6 years ago

pip3 uninstall webwhatsapi

cd C:\projects

mkdir BotExample

git clone https://github.com/mukulhase/WebWhatsapp-Wrapper mv WebWhatsapp-Wrapper\requirements.txt BotExample mv WebWhatsapp-Wrapper\webwhatsapi BotExample rm -rf WebWhatsapp-Wrapper

cd BotExample

cp c:\projects\geckodriver.exe .

pip3 install -r requirements.txt

wget https://raw.githubusercontent.com/mukulhase/WebWhatsapp-Wrapper/e86450c92ea1788f404bbf80dd35e6ed7560faa1/webwhatsapi/js/wapi.js mv wapi.js webwhatsapi\js\wapi.js

wget https://raw.githubusercontent.com/mukulhase/WebWhatsapp-Wrapper/e86450c92ea1788f404bbf80dd35e6ed7560faa1/webwhatsapi/objects/whatsapp_object.py mv whatsapp_object.py webwhatsapi\objects\whatsapp_object.py