3mora2 / WPP_Whatsapp

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
MIT License
75 stars 12 forks source link

Not able to Send Messages - 'Whatsapp' object has no attribute 'autoCloseInterval' #13

Closed HaniaArif closed 1 year ago

HaniaArif commented 1 year ago

Code Used:

 from WPP_Whatsapp import Create

  # start client with your session name
  your_session_name = "test"
  creator = Create(session=your_session_name)
  client = creator.start()
  # Now scan Whatsapp Qrcode in browser

  # check state of login
  if creator.state != 'CONNECTED':
      raise Exception(creator.state)

  phone_number = "+201016708170"  # or "+201016708170"
  message = "hello from wpp"

  # Simple message
  result = client.sendText(phone_number, message)
  creator.close()

Error:

Traceback (most recent call last): File "C:\Users\mz\AppData\Local\Programs\Python\Python310\lib\idlelib\run.py", line 580, in runcode exec(code, self.locals) File "C:\Users\mz\Downloads\whatsapp.py", line 6, in client = creator.start() File "C:\Users\mz\AppData\Local\Programs\Python\Python310\lib\site-packages\WPP_Whatsapp\controllers\initializer.py", line 115, in start self.create() File "C:\Users\mz\AppData\Local\Programs\Python\Python310\lib\site-packages\WPP_Whatsapp\controllers\initializer.py", line 147, in create is_logged = self.client.waitForLogin() File "C:\Users\mz\AppData\Local\Programs\Python\Python310\lib\site-packages\WPP_Whatsapp\api\layers\HostLayer.py", line 276, in waitForLogin self.startAutoClose() File "C:\Users\mz\AppData\Local\Programs\Python\Python310\lib\site-packages\WPP_Whatsapp\api\layers\HostLayer.py", line 190, in startAutoClose if _time > 0 and not self.autoCloseInterval: AttributeError: 'Whatsapp' object has no attribute 'autoCloseInterval'. Did you mean: 'autoCloseIntervalHandel'?

Solutions Tried from Examples Folder:

from WPP_Whatsapp import Create

# start client with your session name
your_session_name = "test"
creator = Create(session=your_session_name, autoClose=0)
client = creator.start()
# Now scan Whatsapp Qrcode in browser

# check state of login
if creator.state != 'CONNECTED':
    raise Exception(creator.state)

phone_number = "201016708170"  # or "+201016708170"
message = "hello from wpp"

# Simple message
result = client.sendText(phone_number, message)

Status:

Additional parameter autoClose=0 in Create() did not work

3mora2 commented 1 year ago

update now

HaniaArif commented 1 year ago

updated using pip install WPP_Whatsapp -U and it works now