WhatsApp Web API Wrapper for Chrome, Firefox, Opera, Brave and Edge.
Installation
pip install pywhapbot
Features
- Send messages by phone number
- Store WhatsApp Web sessions in all the browsers. (Edge only available on Windows)
- Automate the download of Selenium drivers
Simple Usage
from pywhapbot import WhapBot
bot = WhapBot("chrome") # downloads current driver automatically
bot.log() # optional
bot.send("+34123456789", "Hello world!") # forces log
bot.quit()
Download specific drivers automatically
from pywhapbot.install import download_driver
from pywhapbot.utils import get_version
download_driver("firefox", version="0.29.1", root="drivers")
download_driver("opera", version="latest")
download_driver("edge", version="current")
lversion = get_version("brave", "latest")
cversion = get_version("brave", "current")
if cversion < lversion:
print("You should update your browser to the last version")
More advanced example
from pywhapbot import WhapBot
whapbot = WhapBot(
browser="firefox",
driver_path="geckodriver.exe",
profile_path="profiles/firefox-profile",
proxy="169.210.345.10:4567",
kiosk=True # kiosk mode (not supported on opera)
)
whapmsgs = [("+34696969420", "Open!"),
("+34696942069", "Sourcerer!")]
with whapbot as bot: # Context manager of selenium webdriver class
bot.get("https://github.com/saizk")
# Selenium Webdriver command examples
bot.driver.set_window_position(210, 210)
assert len(bot.driver.window_handles) == 1
bot.driver.find_element_by_link_text("new window").click()
bot.driver.switch_to.new_window('tab')
for idx, (phone, message) in enumerate(whapmsgs):
bot.send(phone, message, timeout=15, retries=5) # forces log
bot.screenshot(f"whapbot-{idx}.png")
print(f"{idx+1}/{len(whapmsgs)} messages sent")
# bot.quit() called by the context manager
Contribute
Would you like to contribute to this project? Here are a few starters:
- Improve documentation
- Add Testing examples
- Bug hunts and refactor
- Additional features/ More integrations
- Phantom JS support
- Implement default browser functions for Mac
Metadata
Release files for pywhapbot 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pywhapbot-1.0.2.tar.gz | 10.6 kB | Without provenance | Details for pywhapbot-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pywhapbot-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for pywhapbot-1.0.2-py3-none-any.whl |
Total release size: 21.3 kB
Release files / pywhapbot-1.0.2.tar.gz
| Download URL | pywhapbot-1.0.2.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54b20a2c5f8d509828a0d0f4908b0f0c21f199321b5b8818f269487d137ff554
|
|
BLAKE2b-256 checksum How to use checksums |
c6f486548dbf8f7d8177dd61cd52e70bc6f8ddd9a4cb866e4175514e04bbfa81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8
|
Release files / pywhapbot-1.0.2-py3-none-any.whl
| Download URL | pywhapbot-1.0.2-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b2d3c463f2acbacd51c78f94268409e83e7b7dea7c1c4fbf4fdac71bede7311
|
|
BLAKE2b-256 checksum How to use checksums |
dcf270c29b22d4b78e9964171728bd8d8555c8c5f584766bf382ddc30ff7b39b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8
|
Security for pywhapbot 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.