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.04k stars 793 forks source link

driver.get_qr_plain() getting None value #610

Open balapkm opened 5 years ago

balapkm commented 5 years ago

print(driver.get_qr_plain())

While running above code i am getting None value.

lfdelphino commented 5 years ago

Please provide your full code, you are probably not waiting for it to load fully.

balapkm commented 5 years ago

Code `import os, sys, time, json from webwhatsapi import WhatsAPIDriver from webwhatsapi.objects.message import Message, MediaMessage

print "Environment", os.environ try: os.environ["SELENIUM"] except KeyError: print "Please set the environment variable SELENIUM to Selenium URL" sys.exit(1)

Save session on "/firefox_cache/localStorage.json".

Create the directory "/firefox_cache", it's on .gitignore

The "app" directory is internal to docker, it corresponds to the root of the project.

The profile parameter requires a directory not a file.

profiledir=os.path.join(".","firefox_cache") if not os.path.exists(profiledir): os.makedirs(profiledir) driver = WhatsAPIDriver(profile=profiledir, client='remote', command_executor=os.environ["SELENIUM"]) print("Waiting for QR") print(driver.get_qr_plain()) print("Saving session") driver.save_firefox_profile(remove_old=False) print("Bot started") `

Log

`(base) root@infiniti:/home/Staging/workSpace/python/WebWhatsapp-Wrapper# docker run --network selenium -it -e SELENIUM='http://firefox:4444/wd/hub' -v $(pwd):/app webwhatsapi /bin/bash -c "pip install ./;pip list;python sample/remote.py" DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. Processing /app Requirement already satisfied: python-dateutil>=2.6.0 in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (2.8.0) Requirement already satisfied: selenium>=3.4.3 in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (3.141.0) Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (1.12.0) Requirement already satisfied: python-axolotl in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (0.1.42) Requirement already satisfied: cryptography in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (2.6.1) Requirement already satisfied: python-magic in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (0.4.15) Requirement already satisfied: urllib3 in /usr/local/lib/python2.7/site-packages (from selenium>=3.4.3->webwhatsapi==2.0.3) (1.25.1) Requirement already satisfied: python-axolotl-curve25519 in /usr/local/lib/python2.7/site-packages (from python-axolotl->webwhatsapi==2.0.3) (0.4.1.post2) Requirement already satisfied: protobuf>=3.0.0.b2 in /usr/local/lib/python2.7/site-packages (from python-axolotl->webwhatsapi==2.0.3) (3.7.1) Requirement already satisfied: cffi!=1.11.3,>=1.8 in /usr/local/lib/python2.7/site-packages (from cryptography->webwhatsapi==2.0.3) (1.12.3) Requirement already satisfied: ipaddress; python_version < "3" in /usr/local/lib/python2.7/site-packages (from cryptography->webwhatsapi==2.0.3) (1.0.22) Requirement already satisfied: asn1crypto>=0.21.0 in /usr/local/lib/python2.7/site-packages (from cryptography->webwhatsapi==2.0.3) (0.24.0) Requirement already satisfied: enum34; python_version < "3" in /usr/local/lib/python2.7/site-packages (from cryptography->webwhatsapi==2.0.3) (1.1.6) Requirement already satisfied: setuptools in /usr/local/lib/python2.7/site-packages (from protobuf>=3.0.0.b2->python-axolotl->webwhatsapi==2.0.3) (41.0.1) Requirement already satisfied: pycparser in /usr/local/lib/python2.7/site-packages (from cffi!=1.11.3,>=1.8->cryptography->webwhatsapi==2.0.3) (2.19) Building wheels for collected packages: webwhatsapi Building wheel for webwhatsapi (setup.py) ... done Stored in directory: /tmp/pip-ephem-wheel-cache-Q77Iwk/wheels/4b/1c/59/a69d3cb46a693578104e640ef6e42bbb128292df4586f1cb10 Successfully built webwhatsapi Installing collected packages: webwhatsapi Successfully installed webwhatsapi-2.0.3 DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. Package Version


asn1crypto 0.24.0
cffi 1.12.3
cryptography 2.6.1
enum34 1.1.6
ipaddress 1.0.22
numpy 1.16.3
pip 19.1
protobuf 3.7.1
pycparser 2.19
python-axolotl 0.1.42
python-axolotl-curve25519 0.4.1.post2 python-dateutil 2.8.0
python-magic 0.4.15
selenium 3.141.0
setuptools 41.0.1
six 1.12.0
typing 3.6.6
urllib3 1.25.1
virtualenv 16.5.0
webwhatsapi 2.0.3
wheel 0.33.1
Environment {'LANG': 'C.UTF-8', 'PYTHONIOENCODING': 'UTF-8', 'TERM': 'xterm', 'GPG_KEY': 'C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF', 'PYTHON_VERSION': '2.7.16', 'SHLVL': '1', 'PYTHON_PIPVERSION': '19.1', 'HOSTNAME': '57a4973eeb75', 'SELENIUM': 'http://firefox:4444/wd/hub', 'PWD': '/app', 'PATH': '/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'HOME': '/root', '': '/usr/local/bin/python'} Waiting for QR None Saving session Bot started Checking for more messages, status NotLoggedIn Checking for more messages, status NotLoggedIn Checking for more messages, status NotLoggedIn Checking for more messages, status NotLoggedIn Checking for more messages, status NotLoggedIn Checking for more messages, status NotLoggedIn ` Just run above cmd in terminal and im getting above log . Need to open web whatapp in browser.Kindly tell me process?