whatsfly_labfox 0.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. whatsfly_labfox-0.9.0/LICENSE +21 -0
  2. whatsfly_labfox-0.9.0/PKG-INFO +81 -0
  3. whatsfly_labfox-0.9.0/README.md +31 -0
  4. whatsfly_labfox-0.9.0/pyproject.toml +86 -0
  5. whatsfly_labfox-0.9.0/setup.cfg +4 -0
  6. whatsfly_labfox-0.9.0/tests/test_handle_message.py +50 -0
  7. whatsfly_labfox-0.9.0/whatsfly/__init__.py +42 -0
  8. whatsfly_labfox-0.9.0/whatsfly/dependencies/__init__.py +0 -0
  9. whatsfly_labfox-0.9.0/whatsfly/dependencies/builder.py +117 -0
  10. whatsfly_labfox-0.9.0/whatsfly/dependencies/latest.h +119 -0
  11. whatsfly_labfox-0.9.0/whatsfly/dependencies/latest.so +0 -0
  12. whatsfly_labfox-0.9.0/whatsfly/proto/__init__.py +0 -0
  13. whatsfly_labfox-0.9.0/whatsfly/proto/__pycache__/__init__.cpython-314.pyc +0 -0
  14. whatsfly_labfox-0.9.0/whatsfly/proto/generate_protos.sh +1 -0
  15. whatsfly_labfox-0.9.0/whatsfly/proto/waAdv/WAAdv.pb.raw +0 -0
  16. whatsfly_labfox-0.9.0/whatsfly/proto/waAdv/WAAdv.proto +43 -0
  17. whatsfly_labfox-0.9.0/whatsfly/proto/waAdv/WAAdv_pb2.py +39 -0
  18. whatsfly_labfox-0.9.0/whatsfly/proto/waAdv/__init__.py +0 -0
  19. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloApplication/WAArmadilloApplication.pb.raw +0 -0
  20. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloApplication/WAArmadilloApplication.proto +248 -0
  21. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloApplication/WAArmadilloApplication_pb2.py +132 -0
  22. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloApplication/__init__.py +0 -0
  23. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloBackupMessage/WAArmadilloBackupMessage.pb.raw +15 -0
  24. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloBackupMessage/WAArmadilloBackupMessage.proto +22 -0
  25. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloBackupMessage/WAArmadilloBackupMessage_pb2.py +35 -0
  26. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloBackupMessage/__init__.py +0 -0
  27. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloICDC/WAArmadilloICDC.pb.raw +10 -0
  28. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloICDC/WAArmadilloICDC.proto +15 -0
  29. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloICDC/WAArmadilloICDC_pb2.py +31 -0
  30. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloICDC/__init__.py +0 -0
  31. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloXMA/WAArmadilloXMA.pb.raw +0 -0
  32. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloXMA/WAArmadilloXMA.proto +125 -0
  33. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloXMA/WAArmadilloXMA_pb2.py +41 -0
  34. whatsfly_labfox-0.9.0/whatsfly/proto/waArmadilloXMA/__init__.py +0 -0
  35. whatsfly_labfox-0.9.0/whatsfly/proto/waCert/WACert.pb.raw +23 -0
  36. whatsfly_labfox-0.9.0/whatsfly/proto/waCert/WACert.proto +34 -0
  37. whatsfly_labfox-0.9.0/whatsfly/proto/waCert/WACert_pb2.py +35 -0
  38. whatsfly_labfox-0.9.0/whatsfly/proto/waCert/__init__.py +0 -0
  39. whatsfly_labfox-0.9.0/whatsfly/proto/waChatLockSettings/WAProtobufsChatLockSettings.pb.raw +7 -0
  40. whatsfly_labfox-0.9.0/whatsfly/proto/waChatLockSettings/WAProtobufsChatLockSettings.proto +10 -0
  41. whatsfly_labfox-0.9.0/whatsfly/proto/waChatLockSettings/WAProtobufsChatLockSettings_pb2.py +33 -0
  42. whatsfly_labfox-0.9.0/whatsfly/proto/waChatLockSettings/__init__.py +0 -0
  43. whatsfly_labfox-0.9.0/whatsfly/proto/waCommon/WACommon.pb.raw +0 -0
  44. whatsfly_labfox-0.9.0/whatsfly/proto/waCommon/WACommon.proto +41 -0
  45. whatsfly_labfox-0.9.0/whatsfly/proto/waCommon/WACommon_pb2.py +37 -0
  46. whatsfly_labfox-0.9.0/whatsfly/proto/waCommon/__init__.py +0 -0
  47. whatsfly_labfox-0.9.0/whatsfly/proto/waCompanionReg/WAWebProtobufsCompanionReg.pb.raw +0 -0
  48. whatsfly_labfox-0.9.0/whatsfly/proto/waCompanionReg/WAWebProtobufsCompanionReg.proto +80 -0
  49. whatsfly_labfox-0.9.0/whatsfly/proto/waCompanionReg/WAWebProtobufsCompanionReg_pb2.py +43 -0
  50. whatsfly_labfox-0.9.0/whatsfly/proto/waCompanionReg/__init__.py +0 -0
  51. whatsfly_labfox-0.9.0/whatsfly/proto/waConsumerApplication/WAConsumerApplication.pb.raw +0 -0
  52. whatsfly_labfox-0.9.0/whatsfly/proto/waConsumerApplication/WAConsumerApplication.proto +233 -0
  53. whatsfly_labfox-0.9.0/whatsfly/proto/waConsumerApplication/WAConsumerApplication_pb2.py +103 -0
  54. whatsfly_labfox-0.9.0/whatsfly/proto/waConsumerApplication/__init__.py +0 -0
  55. whatsfly_labfox-0.9.0/whatsfly/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.raw +0 -0
  56. whatsfly_labfox-0.9.0/whatsfly/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.proto +13 -0
  57. whatsfly_labfox-0.9.0/whatsfly/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities_pb2.py +31 -0
  58. whatsfly_labfox-0.9.0/whatsfly/proto/waDeviceCapabilities/__init__.py +0 -0
  59. whatsfly_labfox-0.9.0/whatsfly/proto/waE2E/WAWebProtobufsE2E.pb.raw +0 -0
  60. whatsfly_labfox-0.9.0/whatsfly/proto/waE2E/WAWebProtobufsE2E.proto +1856 -0
  61. whatsfly_labfox-0.9.0/whatsfly/proto/waE2E/WAWebProtobufsE2E_pb2.py +554 -0
  62. whatsfly_labfox-0.9.0/whatsfly/proto/waE2E/__init__.py +0 -0
  63. whatsfly_labfox-0.9.0/whatsfly/proto/waEphemeral/WAWebProtobufsEphemeral.pb.raw +5 -0
  64. whatsfly_labfox-0.9.0/whatsfly/proto/waEphemeral/WAWebProtobufsEphemeral.proto +8 -0
  65. whatsfly_labfox-0.9.0/whatsfly/proto/waEphemeral/WAWebProtobufsEphemeral_pb2.py +29 -0
  66. whatsfly_labfox-0.9.0/whatsfly/proto/waEphemeral/__init__.py +0 -0
  67. whatsfly_labfox-0.9.0/whatsfly/proto/waFingerprint/WAFingerprint.pb.raw +0 -0
  68. whatsfly_labfox-0.9.0/whatsfly/proto/waFingerprint/WAFingerprint.proto +22 -0
  69. whatsfly_labfox-0.9.0/whatsfly/proto/waFingerprint/WAFingerprint_pb2.py +33 -0
  70. whatsfly_labfox-0.9.0/whatsfly/proto/waFingerprint/__init__.py +0 -0
  71. whatsfly_labfox-0.9.0/whatsfly/proto/waHistorySync/WAWebProtobufsHistorySync.pb.raw +0 -0
  72. whatsfly_labfox-0.9.0/whatsfly/proto/waHistorySync/WAWebProtobufsHistorySync.proto +215 -0
  73. whatsfly_labfox-0.9.0/whatsfly/proto/waHistorySync/WAWebProtobufsHistorySync_pb2.py +76 -0
  74. whatsfly_labfox-0.9.0/whatsfly/proto/waHistorySync/__init__.py +0 -0
  75. whatsfly_labfox-0.9.0/whatsfly/proto/waMediaEntryData/WAMediaEntryData.pb.raw +40 -0
  76. whatsfly_labfox-0.9.0/whatsfly/proto/waMediaEntryData/WAMediaEntryData.proto +37 -0
  77. whatsfly_labfox-0.9.0/whatsfly/proto/waMediaEntryData/WAMediaEntryData_pb2.py +33 -0
  78. whatsfly_labfox-0.9.0/whatsfly/proto/waMediaEntryData/__init__.py +0 -0
  79. whatsfly_labfox-0.9.0/whatsfly/proto/waMediaTransport/WAMediaTransport.pb.raw +0 -0
  80. whatsfly_labfox-0.9.0/whatsfly/proto/waMediaTransport/WAMediaTransport.proto +186 -0
  81. whatsfly_labfox-0.9.0/whatsfly/proto/waMediaTransport/WAMediaTransport_pb2.py +91 -0
  82. whatsfly_labfox-0.9.0/whatsfly/proto/waMediaTransport/__init__.py +0 -0
  83. whatsfly_labfox-0.9.0/whatsfly/proto/waMmsRetry/WAMmsRetry.pb.raw +0 -0
  84. whatsfly_labfox-0.9.0/whatsfly/proto/waMmsRetry/WAMmsRetry.proto +20 -0
  85. whatsfly_labfox-0.9.0/whatsfly/proto/waMmsRetry/WAMmsRetry_pb2.py +33 -0
  86. whatsfly_labfox-0.9.0/whatsfly/proto/waMmsRetry/__init__.py +0 -0
  87. whatsfly_labfox-0.9.0/whatsfly/proto/waMsgApplication/WAMsgApplication.pb.raw +0 -0
  88. whatsfly_labfox-0.9.0/whatsfly/proto/waMsgApplication/WAMsgApplication.proto +87 -0
  89. whatsfly_labfox-0.9.0/whatsfly/proto/waMsgApplication/WAMsgApplication_pb2.py +51 -0
  90. whatsfly_labfox-0.9.0/whatsfly/proto/waMsgApplication/__init__.py +0 -0
  91. whatsfly_labfox-0.9.0/whatsfly/proto/waMsgTransport/WAMsgTransport.pb.raw +0 -0
  92. whatsfly_labfox-0.9.0/whatsfly/proto/waMsgTransport/WAMsgTransport.proto +75 -0
  93. whatsfly_labfox-0.9.0/whatsfly/proto/waMsgTransport/WAMsgTransport_pb2.py +65 -0
  94. whatsfly_labfox-0.9.0/whatsfly/proto/waMsgTransport/__init__.py +0 -0
  95. whatsfly_labfox-0.9.0/whatsfly/proto/waMultiDevice/WAMultiDevice.pb.raw +0 -0
  96. whatsfly_labfox-0.9.0/whatsfly/proto/waMultiDevice/WAMultiDevice.proto +57 -0
  97. whatsfly_labfox-0.9.0/whatsfly/proto/waMultiDevice/WAMultiDevice_pb2.py +63 -0
  98. whatsfly_labfox-0.9.0/whatsfly/proto/waMultiDevice/__init__.py +0 -0
  99. whatsfly_labfox-0.9.0/whatsfly/proto/waQuickPromotionSurfaces/WAWebProtobufsQuickPromotionSurfaces.pb.raw +33 -0
  100. whatsfly_labfox-0.9.0/whatsfly/proto/waQuickPromotionSurfaces/WAWebProtobufsQuickPromotionSurfaces.proto +40 -0
  101. whatsfly_labfox-0.9.0/whatsfly/proto/waQuickPromotionSurfaces/WAWebProtobufsQuickPromotionSurfaces_pb2.py +45 -0
  102. whatsfly_labfox-0.9.0/whatsfly/proto/waQuickPromotionSurfaces/__init__.py +0 -0
  103. whatsfly_labfox-0.9.0/whatsfly/proto/waReporting/WAWebProtobufsReporting.pb.raw +32 -0
  104. whatsfly_labfox-0.9.0/whatsfly/proto/waReporting/WAWebProtobufsReporting.proto +23 -0
  105. whatsfly_labfox-0.9.0/whatsfly/proto/waReporting/WAWebProtobufsReporting_pb2.py +41 -0
  106. whatsfly_labfox-0.9.0/whatsfly/proto/waReporting/__init__.py +0 -0
  107. whatsfly_labfox-0.9.0/whatsfly/proto/waRoutingInfo/WAWebProtobufsRoutingInfo.pb.raw +9 -0
  108. whatsfly_labfox-0.9.0/whatsfly/proto/waRoutingInfo/WAWebProtobufsRoutingInfo.proto +12 -0
  109. whatsfly_labfox-0.9.0/whatsfly/proto/waRoutingInfo/WAWebProtobufsRoutingInfo_pb2.py +29 -0
  110. whatsfly_labfox-0.9.0/whatsfly/proto/waRoutingInfo/__init__.py +0 -0
  111. whatsfly_labfox-0.9.0/whatsfly/proto/waServerSync/WAServerSync.pb.raw +0 -0
  112. whatsfly_labfox-0.9.0/whatsfly/proto/waServerSync/WAServerSync.proto +72 -0
  113. whatsfly_labfox-0.9.0/whatsfly/proto/waServerSync/WAServerSync_pb2.py +51 -0
  114. whatsfly_labfox-0.9.0/whatsfly/proto/waServerSync/__init__.py +0 -0
  115. whatsfly_labfox-0.9.0/whatsfly/proto/waSyncAction/WASyncAction.pb.raw +0 -0
  116. whatsfly_labfox-0.9.0/whatsfly/proto/waSyncAction/WASyncAction.proto +440 -0
  117. whatsfly_labfox-0.9.0/whatsfly/proto/waSyncAction/WASyncAction_pb2.py +173 -0
  118. whatsfly_labfox-0.9.0/whatsfly/proto/waSyncAction/__init__.py +0 -0
  119. whatsfly_labfox-0.9.0/whatsfly/proto/waUserPassword/WAProtobufsUserPassword.pb.raw +0 -0
  120. whatsfly_labfox-0.9.0/whatsfly/proto/waUserPassword/WAProtobufsUserPassword.proto +33 -0
  121. whatsfly_labfox-0.9.0/whatsfly/proto/waUserPassword/WAProtobufsUserPassword_pb2.py +37 -0
  122. whatsfly_labfox-0.9.0/whatsfly/proto/waUserPassword/__init__.py +0 -0
  123. whatsfly_labfox-0.9.0/whatsfly/proto/waVnameCert/WAWebProtobufsVnameCert.pb.raw +0 -0
  124. whatsfly_labfox-0.9.0/whatsfly/proto/waVnameCert/WAWebProtobufsVnameCert.proto +72 -0
  125. whatsfly_labfox-0.9.0/whatsfly/proto/waVnameCert/WAWebProtobufsVnameCert_pb2.py +49 -0
  126. whatsfly_labfox-0.9.0/whatsfly/proto/waVnameCert/__init__.py +0 -0
  127. whatsfly_labfox-0.9.0/whatsfly/proto/waWa6/WAWebProtobufsWa6.pb.raw +0 -0
  128. whatsfly_labfox-0.9.0/whatsfly/proto/waWa6/WAWebProtobufsWa6.proto +237 -0
  129. whatsfly_labfox-0.9.0/whatsfly/proto/waWa6/WAWebProtobufsWa6_pb2.py +69 -0
  130. whatsfly_labfox-0.9.0/whatsfly/proto/waWa6/__init__.py +0 -0
  131. whatsfly_labfox-0.9.0/whatsfly/proto/waWeb/WAWebProtobufsWeb.pb.raw +0 -0
  132. whatsfly_labfox-0.9.0/whatsfly/proto/waWeb/WAWebProtobufsWeb.proto +561 -0
  133. whatsfly_labfox-0.9.0/whatsfly/proto/waWeb/WAWebProtobufsWeb_pb2.py +94 -0
  134. whatsfly_labfox-0.9.0/whatsfly/proto/waWeb/__init__.py +0 -0
  135. whatsfly_labfox-0.9.0/whatsfly/whatsapp.py +612 -0
  136. whatsfly_labfox-0.9.0/whatsfly/whatsmeow.py +197 -0
  137. whatsfly_labfox-0.9.0/whatsfly_labfox.egg-info/PKG-INFO +81 -0
  138. whatsfly_labfox-0.9.0/whatsfly_labfox.egg-info/SOURCES.txt +139 -0
  139. whatsfly_labfox-0.9.0/whatsfly_labfox.egg-info/dependency_links.txt +1 -0
  140. whatsfly_labfox-0.9.0/whatsfly_labfox.egg-info/requires.txt +26 -0
  141. whatsfly_labfox-0.9.0/whatsfly_labfox.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Doy Bachtiar, Otamay, David Arnold, LabFox, Ivo Bellin Salarin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.4
2
+ Name: whatsfly_labfox
3
+ Version: 0.9.0
4
+ Summary: Whatsapp Web wrapper in Python, without webdrivers
5
+ Author-email: Labfox <consockbind@gmail.com>, Doy Bachtiar <adityabachtiar996@gmail.com>, Otamay <mauricio@ulisse.io>, Ivo Bellin Salarin <ivo@nilleb.com>
6
+ Project-URL: Homepage, https://whatsfly.labfox.fr
7
+ Project-URL: Repository, https://github.com/Labfox/whatsfly
8
+ Project-URL: Issues, https://github.com/Labfox/whatsfly/issues
9
+ Keywords: whatsfly,whatsapp,python
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Natural Language :: English
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: Unix
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Operating System :: MacOS :: MacOS X
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Environment :: Web Environment
19
+ Classifier: Topic :: Communications
20
+ Classifier: Topic :: Communications :: Chat
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.12
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: types-pyyaml
26
+ Requires-Dist: setuptools
27
+ Requires-Dist: requests
28
+ Requires-Dist: qrcode
29
+ Requires-Dist: protobuf
30
+ Provides-Extra: dev
31
+ Requires-Dist: black; extra == "dev"
32
+ Requires-Dist: isort; extra == "dev"
33
+ Requires-Dist: watchdog; extra == "dev"
34
+ Requires-Dist: mypy; extra == "dev"
35
+ Requires-Dist: vcrpy; extra == "dev"
36
+ Requires-Dist: pytest; extra == "dev"
37
+ Requires-Dist: pytest-vcr; extra == "dev"
38
+ Requires-Dist: pre-commit; extra == "dev"
39
+ Requires-Dist: ruff; extra == "dev"
40
+ Requires-Dist: pytest-asyncio; extra == "dev"
41
+ Requires-Dist: aiosqlite; extra == "dev"
42
+ Provides-Extra: docs
43
+ Requires-Dist: mkdocs; extra == "docs"
44
+ Requires-Dist: mkdocs-material; extra == "docs"
45
+ Requires-Dist: mkdocstrings; extra == "docs"
46
+ Requires-Dist: mkdocstrings-python; extra == "docs"
47
+ Requires-Dist: mike; extra == "docs"
48
+ Requires-Dist: lazydocs; extra == "docs"
49
+ Dynamic: license-file
50
+
51
+ # WhatsFly
52
+ [![Build](https://github.com/Labfox/whatsfly/actions/workflows/build.yml/badge.svg)](https://github.com/Labfox/whatsfly/actions/workflows/build.yml)
53
+
54
+ ## Just run and have fun. Just try and go fly.
55
+
56
+ > [!NOTE]
57
+ > There currently isn't active development, but the project is still maintained. If you want a feature, please create an issue, I'll try to implement it as soon as possible (I usually respond within 1-2 weeks).
58
+
59
+ WhatsApp web wrapper in Python. No selenium nor gecko web driver needed.
60
+
61
+ Setting up browser driver is tricky for python newcomers, and thus it makes your code so 'laggy' while using lots of RAM.
62
+
63
+ This project originates from [cloned-doy/whatsfly](https://github.com/cloned-doy/whatsfly)
64
+
65
+ ## Documentation
66
+
67
+ https://labfox.github.io/whatsfly/
68
+
69
+ ## Supported machines
70
+
71
+ The library theoretically supports every machine with Go and CGo, but if the builds fail on your machine, there are pre-built binaries auto-downloaded for the following architectures:
72
+
73
+ - Linux (amd64)
74
+ - Windows (amd64)
75
+ - macOS (amd64)
76
+ - macOS (arm64)
77
+
78
+ Additionnal architectures can be added by getting a standalone build of the go module, and adding an issue/PR to add a CI job.
79
+
80
+ ## Contributing
81
+ > Please report any bug or unclear behahivor; you can also submit a PR to fix it or add a new feature.
@@ -0,0 +1,31 @@
1
+ # WhatsFly
2
+ [![Build](https://github.com/Labfox/whatsfly/actions/workflows/build.yml/badge.svg)](https://github.com/Labfox/whatsfly/actions/workflows/build.yml)
3
+
4
+ ## Just run and have fun. Just try and go fly.
5
+
6
+ > [!NOTE]
7
+ > There currently isn't active development, but the project is still maintained. If you want a feature, please create an issue, I'll try to implement it as soon as possible (I usually respond within 1-2 weeks).
8
+
9
+ WhatsApp web wrapper in Python. No selenium nor gecko web driver needed.
10
+
11
+ Setting up browser driver is tricky for python newcomers, and thus it makes your code so 'laggy' while using lots of RAM.
12
+
13
+ This project originates from [cloned-doy/whatsfly](https://github.com/cloned-doy/whatsfly)
14
+
15
+ ## Documentation
16
+
17
+ https://labfox.github.io/whatsfly/
18
+
19
+ ## Supported machines
20
+
21
+ The library theoretically supports every machine with Go and CGo, but if the builds fail on your machine, there are pre-built binaries auto-downloaded for the following architectures:
22
+
23
+ - Linux (amd64)
24
+ - Windows (amd64)
25
+ - macOS (amd64)
26
+ - macOS (arm64)
27
+
28
+ Additionnal architectures can be added by getting a standalone build of the go module, and adding an issue/PR to add a CI job.
29
+
30
+ ## Contributing
31
+ > Please report any bug or unclear behahivor; you can also submit a PR to fix it or add a new feature.
@@ -0,0 +1,86 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "whatsfly_labfox"
7
+ version = "0.9.0"
8
+ authors = [
9
+ { name="Labfox", email="consockbind@gmail.com"},
10
+ { name="Doy Bachtiar", email="adityabachtiar996@gmail.com" },
11
+ { name = "Otamay", email="mauricio@ulisse.io"},
12
+ { name = "Ivo Bellin Salarin", email="ivo@nilleb.com"}
13
+ ]
14
+ description = "Whatsapp Web wrapper in Python, without webdrivers"
15
+ readme = "README.md"
16
+ requires-python = ">=3.12"
17
+ keywords = ["whatsfly", "whatsapp", "python"]
18
+ classifiers = [
19
+ "Intended Audience :: Developers",
20
+ "Natural Language :: English",
21
+ "Programming Language :: Python :: 3",
22
+ "License :: OSI Approved :: MIT License",
23
+ "Operating System :: Unix",
24
+ "Operating System :: POSIX :: Linux",
25
+ "Operating System :: MacOS :: MacOS X",
26
+ "Operating System :: Microsoft :: Windows",
27
+ "Environment :: Web Environment",
28
+ "Topic :: Communications",
29
+ "Topic :: Communications :: Chat",
30
+ "Topic :: Software Development :: Libraries :: Python Modules",
31
+ ]
32
+ dependencies = [
33
+ "types-pyyaml",
34
+ "setuptools",
35
+ "requests",
36
+ "qrcode",
37
+ "protobuf",
38
+ ]
39
+
40
+ [project.optional-dependencies]
41
+ dev = [
42
+ "black",
43
+ "isort",
44
+ "watchdog",
45
+ "mypy",
46
+ "vcrpy",
47
+ "pytest",
48
+ "pytest-vcr",
49
+ "pre-commit",
50
+ "ruff",
51
+ "pytest-asyncio",
52
+ "aiosqlite",
53
+ ]
54
+ docs = [
55
+ "mkdocs",
56
+ "mkdocs-material",
57
+ "mkdocstrings",
58
+ "mkdocstrings-python",
59
+ "mike",
60
+ "lazydocs",
61
+ ]
62
+
63
+ [project.urls]
64
+ Homepage = "https://whatsfly.labfox.fr"
65
+ Repository = "https://github.com/Labfox/whatsfly"
66
+ Issues = "https://github.com/Labfox/whatsfly/issues"
67
+
68
+ [tool.setuptools]
69
+ packages = ["whatsfly"]
70
+ include-package-data = true
71
+
72
+ [tool.setuptools.package-data]
73
+ whatsfly = [
74
+ "dependencies/*.*",
75
+ "proto/*",
76
+ "proto/*/*"
77
+ ]
78
+
79
+ [tool.setuptools.exclude-package-data]
80
+ whatsfly = [
81
+ "dependencies/whatsmeow/static/*"
82
+ ]
83
+
84
+ [[tool.mypy.overrides]]
85
+ module = "whatsfly.proto.*"
86
+ ignore_errors = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,50 @@
1
+ import json
2
+ import unittest
3
+ from unittest.mock import MagicMock, patch
4
+ from whatsfly.whatsapp import WhatsApp
5
+
6
+
7
+ class TestWhatsAppHandleMessage(unittest.TestCase):
8
+ @patch("whatsfly.whatsapp.new_whatsapp_client_wrapper")
9
+ @patch("whatsfly.whatsapp.threading.Thread")
10
+ def setUp(self, mock_thread, mock_new_client):
11
+ self.whatsapp = WhatsApp()
12
+ # Mocking necessary attributes to avoid errors during tests
13
+ self.whatsapp.c_WhatsAppClientId = 1
14
+ self.whatsapp._userEventHandlers = [MagicMock()]
15
+
16
+ def test_handle_message_with_dict_content(self):
17
+ message_data = {"eventType": "testEvent", "content": {"key": "value"}}
18
+ encoded_message = json.dumps(message_data).encode()
19
+
20
+ self.whatsapp._handleMessage(encoded_message)
21
+
22
+ expected_thandler = {
23
+ "eventType": "testEvent",
24
+ "content": {"key": "value"},
25
+ "key": "value",
26
+ }
27
+ self.whatsapp._userEventHandlers[0].assert_called_with(
28
+ self.whatsapp, expected_thandler
29
+ )
30
+
31
+ def test_handle_message_with_str_content(self):
32
+ message_data = {"eventType": "qrCode", "content": "some_qr_code_string"}
33
+ encoded_message = json.dumps(message_data).encode()
34
+
35
+ # Mocking qrcode to avoid actual printing/processing
36
+ with patch("qrcode.QRCode") as _:
37
+ self.whatsapp._handleMessage(encoded_message)
38
+
39
+ expected_thandler = {"eventType": "qrCode", "content": "some_qr_code_string"}
40
+ self.whatsapp._userEventHandlers[0].assert_called_with(
41
+ self.whatsapp, expected_thandler
42
+ )
43
+
44
+ def test_handle_message_invalid_json(self):
45
+ with self.assertRaises(json.JSONDecodeError):
46
+ self.whatsapp._handleMessage(b"invalid json")
47
+
48
+
49
+ if __name__ == "__main__":
50
+ unittest.main()
@@ -0,0 +1,42 @@
1
+ import os
2
+ import logging
3
+ import time
4
+
5
+ from .dependencies.builder import ensureUsableBinaries
6
+
7
+ try:
8
+ if "WHATSFLY_NO_UPDATES" not in os.environ:
9
+ root_dir = os.path.abspath(os.path.dirname(__file__))
10
+ update_file = os.path.join(root_dir, "last_binary_update.txt")
11
+ if os.path.exists(update_file):
12
+ last_update = open(update_file, "r").read()
13
+ if time.time() - int(last_update) > 60 * 60 * 24 * 31:
14
+ from sys import platform
15
+
16
+ if platform == "darwin":
17
+ file_ext = "latest.dylib"
18
+ elif platform in ("win32", "cygwin"):
19
+ file_ext = "latest.dll"
20
+ else:
21
+ file_ext = "latest.so"
22
+ os.remove(update_file)
23
+ os.remove(f"{root_dir}/dependencies/{file_ext}")
24
+ else:
25
+ f = open(update_file, "w")
26
+ f.write(str(int(time.time())))
27
+ f.close()
28
+ except Exception as e:
29
+ print("Unable to ensure updates timeframe")
30
+ print(e)
31
+
32
+ try:
33
+ from .whatsapp import WhatsApp
34
+ except OSError:
35
+ ensureUsableBinaries()
36
+ from .whatsapp import WhatsApp
37
+
38
+
39
+ __all__ = ["WhatsApp"]
40
+
41
+ LOGGER = logging.getLogger()
42
+ logging.basicConfig(level=logging.INFO)
@@ -0,0 +1,117 @@
1
+ import logging
2
+
3
+ import requests
4
+ from setuptools.command.install import install
5
+ import subprocess
6
+ import platform
7
+ import os
8
+
9
+
10
+ def download_file(file, path, isSymLink=True):
11
+ if isSymLink:
12
+ r = requests.get(
13
+ f"https://raw.githubusercontent.com/Labfox/whatsfly/refs/heads/prebuilts/{file}"
14
+ )
15
+ if r.status_code != 200:
16
+ raise FileNotFoundError()
17
+
18
+ file = r.text
19
+
20
+ r2 = requests.get(
21
+ f"https://raw.githubusercontent.com/Labfox/whatsfly/refs/heads/prebuilts/{file}"
22
+ )
23
+
24
+ open(path, "wb").write(r2.content)
25
+
26
+
27
+ def get_dll_filename(branch="main"):
28
+ current_os = platform.system().lower()
29
+ current_arch = platform.machine().lower()
30
+
31
+ # Map the architecture to Go's naming convention
32
+ arch_map = {
33
+ "x86_64": "amd64",
34
+ "arm64": "arm64",
35
+ "aarch64": "arm64",
36
+ }
37
+
38
+ extension_map = {"linux": "so", "windows": "dll", "darwin": "dylib"}
39
+
40
+ go_arch = arch_map.get(current_arch, current_arch)
41
+ dll_extension = extension_map.get(current_os, current_os)
42
+
43
+ return f"{current_os}-{go_arch}-{branch}/latest.{dll_extension}"
44
+
45
+
46
+ def get_extension_name():
47
+ current_os = platform.system().lower()
48
+
49
+ extension_map = {"linux": "so", "windows": "dll", "darwin": "dylib"}
50
+
51
+ dll_extension = extension_map.get(current_os, current_os)
52
+ return dll_extension
53
+
54
+
55
+ def build():
56
+ # Define the Go build command, something like
57
+ # GOOS=darwin GOARCH=amd64 go build -buildmode=c-shared -o ./whatsmeow/whatsmeow-darwin-amd64.dylib main.go
58
+ # Detect the current OS and architecture
59
+ current_os = platform.system().lower()
60
+
61
+ extension_map = {"linux": "so", "windows": "dll", "darwin": "dylib"}
62
+
63
+ dll_extension = extension_map.get(current_os, current_os)
64
+
65
+ # Set the environment variables for Go build
66
+
67
+ root_dir = os.path.abspath(os.path.dirname(__file__))
68
+
69
+ go_build_cmd = [
70
+ "go",
71
+ "build",
72
+ "-buildmode=c-shared",
73
+ "-o",
74
+ f"{root_dir}/latest.{dll_extension}",
75
+ "main.go",
76
+ ]
77
+ logging.debug(
78
+ f"building Go module with command: {' '.join(go_build_cmd)} in directory {os.getcwd()}/whatsfly/dependencies"
79
+ )
80
+
81
+ root_dir = os.path.abspath(os.path.dirname(__file__))
82
+
83
+ # Run the Go build command
84
+ status_code = subprocess.check_call(go_build_cmd)
85
+ logging.debug(f"Go build command exited with status code: {status_code}")
86
+ if status_code == 127:
87
+ raise RuntimeError("Go build impossible")
88
+ if status_code != 0:
89
+ raise RuntimeError("Go build failed - this package cannot be installed")
90
+
91
+
92
+ def ensureUsableBinaries():
93
+ branch = "main"
94
+ logging.info("Trying to download pre-built binaries")
95
+ root_dir = os.path.abspath(os.path.dirname(__file__))
96
+
97
+ download_file(
98
+ get_dll_filename(branch=branch),
99
+ f"{root_dir}/latest.{get_extension_name()}",
100
+ isSymLink=True,
101
+ )
102
+
103
+
104
+ class BuildGoModule(install):
105
+ def run(self):
106
+ # Ensure the Go module is built before the Python package
107
+ self.build_go_module()
108
+ super().run()
109
+
110
+ def build_go_module(self):
111
+ try:
112
+ build()
113
+ except RuntimeError:
114
+ logging.warning("Build unsuccessful, will retry on runtime")
115
+
116
+
117
+ # ensureUsableBinaries()
@@ -0,0 +1,119 @@
1
+ /* Code generated by cmd/cgo; DO NOT EDIT. */
2
+
3
+ /* package github.com/Labfox/whatsfly/backend */
4
+
5
+
6
+ #line 1 "cgo-builtin-export-prolog"
7
+
8
+ #include <stddef.h>
9
+
10
+ #ifndef GO_CGO_EXPORT_PROLOGUE_H
11
+ #define GO_CGO_EXPORT_PROLOGUE_H
12
+
13
+ #ifndef GO_CGO_GOSTRING_TYPEDEF
14
+ typedef struct { const char *p; ptrdiff_t n; } _GoString_;
15
+ extern size_t _GoStringLen(_GoString_ s);
16
+ extern const char *_GoStringPtr(_GoString_ s);
17
+ #endif
18
+
19
+ #endif
20
+
21
+ /* Start of preamble from import "C" comments. */
22
+
23
+
24
+ #line 3 "main.go"
25
+ #include "wapp.h"
26
+ #include <string.h>
27
+ #include <stdlib.h>
28
+ #include <stdint.h>
29
+
30
+ #line 1 "cgo-generated-wrapper"
31
+
32
+
33
+ /* End of preamble from import "C" comments. */
34
+
35
+
36
+ /* Start of boilerplate cgo prologue. */
37
+ #line 1 "cgo-gcc-export-header-prolog"
38
+
39
+ #ifndef GO_CGO_PROLOGUE_H
40
+ #define GO_CGO_PROLOGUE_H
41
+
42
+ typedef signed char GoInt8;
43
+ typedef unsigned char GoUint8;
44
+ typedef short GoInt16;
45
+ typedef unsigned short GoUint16;
46
+ typedef int GoInt32;
47
+ typedef unsigned int GoUint32;
48
+ typedef long long GoInt64;
49
+ typedef unsigned long long GoUint64;
50
+ typedef GoInt64 GoInt;
51
+ typedef GoUint64 GoUint;
52
+ typedef size_t GoUintptr;
53
+ typedef float GoFloat32;
54
+ typedef double GoFloat64;
55
+ #ifdef _MSC_VER
56
+ #if !defined(__cplusplus) || _MSVC_LANG <= 201402L
57
+ #include <complex.h>
58
+ typedef _Fcomplex GoComplex64;
59
+ typedef _Dcomplex GoComplex128;
60
+ #else
61
+ #include <complex>
62
+ typedef std::complex<float> GoComplex64;
63
+ typedef std::complex<double> GoComplex128;
64
+ #endif
65
+ #else
66
+ typedef float _Complex GoComplex64;
67
+ typedef double _Complex GoComplex128;
68
+ #endif
69
+
70
+ /*
71
+ static assertion to make sure the file is being used on architecture
72
+ at least with matching size of GoInt.
73
+ */
74
+ typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
75
+
76
+ #ifndef GO_CGO_GOSTRING_TYPEDEF
77
+ typedef _GoString_ GoString;
78
+ #endif
79
+ typedef void *GoMap;
80
+ typedef void *GoChan;
81
+ typedef struct { void *t; void *v; } GoInterface;
82
+ typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
83
+
84
+ #endif
85
+
86
+ /* End of boilerplate cgo prologue. */
87
+
88
+ #ifdef __cplusplus
89
+ extern "C" {
90
+ #endif
91
+
92
+ extern int NewWhatsAppClientWrapper(char* c_phone_number, char* c_media_path, ptr_to_pyfunc fn_disconnect_callback, ptr_to_pyfunc_str fn_event_callback);
93
+ extern void ConnectWrapper(int id, char* c_dbpath);
94
+ extern void DisconnectWrapper(int id);
95
+ extern int ConnectedWrapper(int id);
96
+ extern int LoggedInWrapper(int id);
97
+ extern void MessageThreadWrapper(int id);
98
+ extern int SendMessageProtobufWrapper(int id, char* c_phone_number, char* c_message, _Bool c_is_group);
99
+ extern int SendMessageWithUploadWrapper(int id, char* c_phone_number, char* c_message, _Bool c_is_group, char* c_upload_id, char* c_mimetype, char* c_kind, _Bool c_ispb, char* c_thumbnail_path);
100
+ extern int GetGroupInviteLinkWrapper(int id, char* c_jid, _Bool c_reset, char* c_return_id);
101
+ extern int JoinGroupWithInviteLinkWrapper(int id, char* c_link);
102
+ extern int SetGroupAnnounceWrapper(int id, char* c_jid, _Bool c_announce);
103
+ extern int SetGroupLockedWrapper(int id, char* c_jid, _Bool c_locked);
104
+ extern int SetGroupNameWrapper(int id, char* c_jid, char* c_name);
105
+ extern int SetGroupTopicWrapper(int id, char* c_jid, char* c_topic);
106
+ extern int GetGroupInfoWrapper(int id, char* c_jid, char* c_return_id);
107
+ extern int UploadFileWrapper(int id, char* c_path, char* c_kind, char* c_return_id);
108
+ extern int SendReactionWrapper(int id, char* c_jid, char* c_message_id, char* c_sender_jid, char* c_reaction, _Bool c_group);
109
+ extern int CreateNewsletterWrapper(int id, char* c_name, char* c_description, char* c_picture_path, char* c_return_id);
110
+ extern int GetNewsletterInfoWrapper(int id, char* c_jid, char* c_return_id);
111
+ extern int GetNewsletterMessagesWrapper(int id, char* c_jid, int count, int before, char* c_return_id);
112
+ extern int GetSubscribedNewslettersWrapper(int id, char* c_return_id);
113
+ extern int UploadNewsletterWrapper(int id, char* c_path, char* c_kind, char* c_return_id);
114
+ extern int SendNewsletterWrapper(int id, char* c_jid, char* c_message, char* c_upload_id);
115
+ extern int Version(void);
116
+
117
+ #ifdef __cplusplus
118
+ }
119
+ #endif
File without changes
@@ -0,0 +1 @@
1
+ protoc --proto_path=. --python_out=. */*.proto
@@ -0,0 +1,43 @@
1
+ syntax = "proto2";
2
+ package WAAdv;
3
+ option go_package = "go.mau.fi/whatsmeow/proto/waAdv";
4
+
5
+ enum ADVEncryptionType {
6
+ E2EE = 0;
7
+ HOSTED = 1;
8
+ }
9
+
10
+ message ADVKeyIndexList {
11
+ optional uint32 rawID = 1;
12
+ optional uint64 timestamp = 2;
13
+ optional uint32 currentIndex = 3;
14
+ repeated uint32 validIndexes = 4 [packed=true];
15
+ optional ADVEncryptionType accountType = 5;
16
+ }
17
+
18
+ message ADVSignedKeyIndexList {
19
+ optional bytes details = 1;
20
+ optional bytes accountSignature = 2;
21
+ optional bytes accountSignatureKey = 3;
22
+ }
23
+
24
+ message ADVDeviceIdentity {
25
+ optional uint32 rawID = 1;
26
+ optional uint64 timestamp = 2;
27
+ optional uint32 keyIndex = 3;
28
+ optional ADVEncryptionType accountType = 4;
29
+ optional ADVEncryptionType deviceType = 5;
30
+ }
31
+
32
+ message ADVSignedDeviceIdentity {
33
+ optional bytes details = 1;
34
+ optional bytes accountSignatureKey = 2;
35
+ optional bytes accountSignature = 3;
36
+ optional bytes deviceSignature = 4;
37
+ }
38
+
39
+ message ADVSignedDeviceIdentityHMAC {
40
+ optional bytes details = 1;
41
+ optional bytes HMAC = 2;
42
+ optional ADVEncryptionType accountType = 3;
43
+ }
@@ -0,0 +1,39 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: waAdv/WAAdv.proto
4
+ """Generated protocol buffer code."""
5
+
6
+ from google.protobuf.internal import builder as _builder
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import symbol_database as _symbol_database
10
+
11
+ # @@protoc_insertion_point(imports)
12
+
13
+ _sym_db = _symbol_database.Default()
14
+
15
+
16
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
17
+ b'\n\x11waAdv/WAAdv.proto\x12\x05WAAdv"\x92\x01\n\x0f\x41\x44VKeyIndexList\x12\r\n\x05rawID\x18\x01 \x01(\r\x12\x11\n\ttimestamp\x18\x02 \x01(\x04\x12\x14\n\x0c\x63urrentIndex\x18\x03 \x01(\r\x12\x18\n\x0cvalidIndexes\x18\x04 \x03(\rB\x02\x10\x01\x12-\n\x0b\x61\x63\x63ountType\x18\x05 \x01(\x0e\x32\x18.WAAdv.ADVEncryptionType"_\n\x15\x41\x44VSignedKeyIndexList\x12\x0f\n\x07\x64\x65tails\x18\x01 \x01(\x0c\x12\x18\n\x10\x61\x63\x63ountSignature\x18\x02 \x01(\x0c\x12\x1b\n\x13\x61\x63\x63ountSignatureKey\x18\x03 \x01(\x0c"\xa4\x01\n\x11\x41\x44VDeviceIdentity\x12\r\n\x05rawID\x18\x01 \x01(\r\x12\x11\n\ttimestamp\x18\x02 \x01(\x04\x12\x10\n\x08keyIndex\x18\x03 \x01(\r\x12-\n\x0b\x61\x63\x63ountType\x18\x04 \x01(\x0e\x32\x18.WAAdv.ADVEncryptionType\x12,\n\ndeviceType\x18\x05 \x01(\x0e\x32\x18.WAAdv.ADVEncryptionType"z\n\x17\x41\x44VSignedDeviceIdentity\x12\x0f\n\x07\x64\x65tails\x18\x01 \x01(\x0c\x12\x1b\n\x13\x61\x63\x63ountSignatureKey\x18\x02 \x01(\x0c\x12\x18\n\x10\x61\x63\x63ountSignature\x18\x03 \x01(\x0c\x12\x17\n\x0f\x64\x65viceSignature\x18\x04 \x01(\x0c"k\n\x1b\x41\x44VSignedDeviceIdentityHMAC\x12\x0f\n\x07\x64\x65tails\x18\x01 \x01(\x0c\x12\x0c\n\x04HMAC\x18\x02 \x01(\x0c\x12-\n\x0b\x61\x63\x63ountType\x18\x03 \x01(\x0e\x32\x18.WAAdv.ADVEncryptionType*)\n\x11\x41\x44VEncryptionType\x12\x08\n\x04\x45\x32\x45\x45\x10\x00\x12\n\n\x06HOSTED\x10\x01\x42!Z\x1fgo.mau.fi/whatsmeow/proto/waAdv'
18
+ )
19
+
20
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
21
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "waAdv.WAAdv_pb2", globals())
22
+ if _descriptor._USE_C_DESCRIPTORS == False:
23
+ DESCRIPTOR._options = None
24
+ DESCRIPTOR._serialized_options = b"Z\037go.mau.fi/whatsmeow/proto/waAdv"
25
+ _ADVKEYINDEXLIST.fields_by_name["validIndexes"]._options = None
26
+ _ADVKEYINDEXLIST.fields_by_name["validIndexes"]._serialized_options = b"\020\001"
27
+ _ADVENCRYPTIONTYPE._serialized_start = 674
28
+ _ADVENCRYPTIONTYPE._serialized_end = 715
29
+ _ADVKEYINDEXLIST._serialized_start = 29
30
+ _ADVKEYINDEXLIST._serialized_end = 175
31
+ _ADVSIGNEDKEYINDEXLIST._serialized_start = 177
32
+ _ADVSIGNEDKEYINDEXLIST._serialized_end = 272
33
+ _ADVDEVICEIDENTITY._serialized_start = 275
34
+ _ADVDEVICEIDENTITY._serialized_end = 439
35
+ _ADVSIGNEDDEVICEIDENTITY._serialized_start = 441
36
+ _ADVSIGNEDDEVICEIDENTITY._serialized_end = 563
37
+ _ADVSIGNEDDEVICEIDENTITYHMAC._serialized_start = 565
38
+ _ADVSIGNEDDEVICEIDENTITYHMAC._serialized_end = 672
39
+ # @@protoc_insertion_point(module_scope)
File without changes