open-wa / wa-automate-python

💬 🤖 The most advanced Python whatsapp library for chatbots with advanced features. Be sure to ⭐ this repository for updates!
Other
330 stars 71 forks source link

Using without GUI #85

Closed cunha-fabricio closed 2 years ago

cunha-fabricio commented 2 years ago

Hi folks,

First of all, I'd like to say that open-wa is such as amazing thing that I never had studied, that's why I'm here finding out for some help.

Question: Is there some way of obtain the QrCode without GUI? directly at the terminal... because I'm coding the following and it's always opening the browser.

So far, thanks for this code.

`os.environ["SELENIUM"]='127.0.0.1:4444'

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"])`

mrodal commented 2 years ago

Hi, you can get the plain qr code with driver.get_qr_plain() and then generate a qr with some library like this: https://pythonhosted.org/PyQRCode/rendering.html