Skip to main content

A Python library to interact with WhatsApp Web using Selenium.

Project description

WhatsApp Library

A Python library to interact with WhatsApp Web using Selenium. Created by Fioruci, used mainly by VJ Bots.

Installation

Install the required packages using pip:

pip install selenium

Usage Example

from vjwhats import WhatsApp
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from pathlib import Path

def main():
    # Configures of the current folder of Chrome/User Data and the desired profile directory
    chrome_options = Options()
    chrome_options.add_argument("user-data-dir=C:/Users/EXAMPLE/AppData/Local/Google/Chrome/User Data")
    chrome_options.add_argument("profile-directory=Default")  # It should be the same user as the connected to the WhatsApp Web

    # Creating the WebDriver with Options
    driver = webdriver.Chrome(options=chrome_options)

    # Creating WhatsApp Instance
    wpp = WhatsApp(driver)

    # Sending a message to Contact 1
    wpp.find_by_username("Contact 1")
    wpp.send_message("Hello, this is a test message!")

    # Sending a file to Contact 2
    wpp.find_by_username("Contact 2")
    wpp.send_file(Path("path/to/file"), which=1)

    # Sending a file to a new Conversation
    wpp.start_conversation("+55999977885")
    wpp.send_file(Path("path/to/file"), which=1)

if __name__ == "__main__":
    main()

Licence

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vjwhats-1.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vjwhats-1.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file vjwhats-1.1.tar.gz.

File metadata

  • Download URL: vjwhats-1.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for vjwhats-1.1.tar.gz
Algorithm Hash digest
SHA256 64f21e361e1dda5b50ace37567cb08f0200116370aa21cf6b6981c9655e867a0
MD5 bf5f8ea1b220ca1123da50b591af8234
BLAKE2b-256 b0ed6d6a55b0633040cbaa3579d7072f1d07f33bf184a08760f1f100c0199890

See more details on using hashes here.

File details

Details for the file vjwhats-1.1-py3-none-any.whl.

File metadata

  • Download URL: vjwhats-1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for vjwhats-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9af0bb30358665ad32b6cfb31ce0392246c4903c0a51e767b2dacca62ceb35a6
MD5 ffe1b5f889e7544a757d3b01efaa7703
BLAKE2b-256 d6345228bcd99492cf912fdc1040b896015bc74a4980b2f3a5ef577c3bea2d7d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page