-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
129 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import os | ||
from nodesemver import max_satisfying, _sorted, satisfies | ||
import requests | ||
|
||
|
||
def getAvailableVersions(versionMatch=None, includePrerelease=True): | ||
r = requests.get("https://api.github.com/repos/wppconnect-team/wa-version/contents/html") | ||
if not r.ok: | ||
return [] | ||
versions = [os.path.splitext(da.get("name"))[0] for da in r.json()] | ||
sorted_versions = _sorted(versions) | ||
|
||
if versionMatch: | ||
return [v for v in sorted_versions if satisfies(v, versionMatch, include_prerelease=includePrerelease)] | ||
else: | ||
return sorted_versions | ||
|
||
|
||
def getLatestVersion(versionMatch='*', includePrerelease=True): | ||
versions = getAvailableVersions() | ||
|
||
max_version = max_satisfying(versions, versionMatch, include_prerelease=includePrerelease) | ||
|
||
return (max_version or versions[-1]).raw | ||
|
||
|
||
def getPageContent(versionMatch=None, includePrerelease=True): | ||
if versionMatch is None: | ||
versionMatch = getLatestVersion() | ||
|
||
versions = getAvailableVersions() | ||
|
||
max_version = max_satisfying(versions, versionMatch, include_prerelease=includePrerelease) | ||
|
||
if not max_version: | ||
raise ValueError(f"Version not available for {versionMatch}") | ||
r = requests.get(f"https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/{max_version.raw}.html") | ||
if r.ok: | ||
return r.text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from WPP_Whatsapp import Create | ||
|
||
import logging | ||
|
||
logger = logging.getLogger(name="WPP_Whatsapp") | ||
logger.setLevel(logging.DEBUG) | ||
|
||
# start client with your session name | ||
your_session_name = "test" | ||
creator = Create(session=your_session_name, browser="chrome", version="2.2409.2") | ||
client = creator.start() | ||
# Now scan Whatsapp Qrcode in browser | ||
|
||
# check state of login | ||
if creator.state != 'CONNECTED': | ||
raise Exception(creator.state) | ||
|
||
print(client.getWAVersion()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ pyee | |
segno | ||
typing_extensions | ||
requests | ||
node-semver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters