freenub 0.1.0__py3-none-any.whl

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 (163) hide show
  1. freenub-0.1.0.dist-info/LICENSE +27 -0
  2. freenub-0.1.0.dist-info/METADATA +104 -0
  3. freenub-0.1.0.dist-info/RECORD +163 -0
  4. freenub-0.1.0.dist-info/WHEEL +4 -0
  5. pubnub/__init__.py +21 -0
  6. pubnub/builders.py +69 -0
  7. pubnub/callbacks.py +47 -0
  8. pubnub/crypto.py +125 -0
  9. pubnub/crypto_core.py +11 -0
  10. pubnub/dtos.py +29 -0
  11. pubnub/endpoints/__init__.py +0 -0
  12. pubnub/endpoints/access/__init__.py +0 -0
  13. pubnub/endpoints/access/audit.py +80 -0
  14. pubnub/endpoints/access/grant.py +183 -0
  15. pubnub/endpoints/access/grant_token.py +129 -0
  16. pubnub/endpoints/access/revoke_token.py +46 -0
  17. pubnub/endpoints/channel_groups/__init__.py +0 -0
  18. pubnub/endpoints/channel_groups/add_channel_to_channel_group.py +68 -0
  19. pubnub/endpoints/channel_groups/list_channels_in_channel_group.py +59 -0
  20. pubnub/endpoints/channel_groups/remove_channel_from_channel_group.py +68 -0
  21. pubnub/endpoints/channel_groups/remove_channel_group.py +56 -0
  22. pubnub/endpoints/endpoint.py +334 -0
  23. pubnub/endpoints/entities/__init__.py +0 -0
  24. pubnub/endpoints/entities/endpoint.py +239 -0
  25. pubnub/endpoints/entities/membership/__init__.py +0 -0
  26. pubnub/endpoints/entities/membership/add_memberships.py +110 -0
  27. pubnub/endpoints/entities/membership/fetch_memberships.py +76 -0
  28. pubnub/endpoints/entities/membership/remove_memberships.py +103 -0
  29. pubnub/endpoints/entities/membership/update_memberships.py +110 -0
  30. pubnub/endpoints/entities/space/__init__.py +0 -0
  31. pubnub/endpoints/entities/space/create_space.py +78 -0
  32. pubnub/endpoints/entities/space/fetch_space.py +37 -0
  33. pubnub/endpoints/entities/space/fetch_spaces.py +32 -0
  34. pubnub/endpoints/entities/space/remove_space.py +32 -0
  35. pubnub/endpoints/entities/space/update_space.py +77 -0
  36. pubnub/endpoints/entities/user/__init__.py +0 -0
  37. pubnub/endpoints/entities/user/create_user.py +83 -0
  38. pubnub/endpoints/entities/user/fetch_user.py +37 -0
  39. pubnub/endpoints/entities/user/fetch_users.py +31 -0
  40. pubnub/endpoints/entities/user/remove_user.py +32 -0
  41. pubnub/endpoints/entities/user/update_user.py +83 -0
  42. pubnub/endpoints/fetch_messages.py +181 -0
  43. pubnub/endpoints/file_operations/__init__.py +0 -0
  44. pubnub/endpoints/file_operations/delete_file.py +53 -0
  45. pubnub/endpoints/file_operations/download_file.py +88 -0
  46. pubnub/endpoints/file_operations/download_file_asyncio.py +26 -0
  47. pubnub/endpoints/file_operations/fetch_upload_details.py +50 -0
  48. pubnub/endpoints/file_operations/file_based_endpoint.py +17 -0
  49. pubnub/endpoints/file_operations/get_file_url.py +71 -0
  50. pubnub/endpoints/file_operations/list_files.py +39 -0
  51. pubnub/endpoints/file_operations/publish_file_message.py +107 -0
  52. pubnub/endpoints/file_operations/send_file.py +154 -0
  53. pubnub/endpoints/file_operations/send_file_asyncio.py +60 -0
  54. pubnub/endpoints/history.py +115 -0
  55. pubnub/endpoints/history_delete.py +67 -0
  56. pubnub/endpoints/message_actions/__init__.py +0 -0
  57. pubnub/endpoints/message_actions/add_message_action.py +85 -0
  58. pubnub/endpoints/message_actions/get_message_actions.py +88 -0
  59. pubnub/endpoints/message_actions/remove_message_action.py +79 -0
  60. pubnub/endpoints/message_count.py +68 -0
  61. pubnub/endpoints/mixins.py +33 -0
  62. pubnub/endpoints/objects_v2/__init__.py +0 -0
  63. pubnub/endpoints/objects_v2/channel/__init__.py +0 -0
  64. pubnub/endpoints/objects_v2/channel/get_all_channels.py +31 -0
  65. pubnub/endpoints/objects_v2/channel/get_channel.py +37 -0
  66. pubnub/endpoints/objects_v2/channel/remove_channel.py +35 -0
  67. pubnub/endpoints/objects_v2/channel/set_channel.py +61 -0
  68. pubnub/endpoints/objects_v2/members/__init__.py +0 -0
  69. pubnub/endpoints/objects_v2/members/get_channel_members.py +47 -0
  70. pubnub/endpoints/objects_v2/members/manage_channel_members.py +74 -0
  71. pubnub/endpoints/objects_v2/members/remove_channel_members.py +65 -0
  72. pubnub/endpoints/objects_v2/members/set_channel_members.py +63 -0
  73. pubnub/endpoints/objects_v2/memberships/__init__.py +0 -0
  74. pubnub/endpoints/objects_v2/memberships/get_memberships.py +47 -0
  75. pubnub/endpoints/objects_v2/memberships/manage_memberships.py +75 -0
  76. pubnub/endpoints/objects_v2/memberships/remove_memberships.py +63 -0
  77. pubnub/endpoints/objects_v2/memberships/set_memberships.py +63 -0
  78. pubnub/endpoints/objects_v2/objects_endpoint.py +214 -0
  79. pubnub/endpoints/objects_v2/uuid/__init__.py +0 -0
  80. pubnub/endpoints/objects_v2/uuid/get_all_uuid.py +31 -0
  81. pubnub/endpoints/objects_v2/uuid/get_uuid.py +37 -0
  82. pubnub/endpoints/objects_v2/uuid/remove_uuid.py +32 -0
  83. pubnub/endpoints/objects_v2/uuid/set_uuid.py +73 -0
  84. pubnub/endpoints/presence/__init__.py +0 -0
  85. pubnub/endpoints/presence/get_state.py +80 -0
  86. pubnub/endpoints/presence/heartbeat.py +79 -0
  87. pubnub/endpoints/presence/here_now.py +79 -0
  88. pubnub/endpoints/presence/leave.py +78 -0
  89. pubnub/endpoints/presence/set_state.py +103 -0
  90. pubnub/endpoints/presence/where_now.py +52 -0
  91. pubnub/endpoints/pubsub/__init__.py +0 -0
  92. pubnub/endpoints/pubsub/fire.py +147 -0
  93. pubnub/endpoints/pubsub/publish.py +177 -0
  94. pubnub/endpoints/pubsub/subscribe.py +102 -0
  95. pubnub/endpoints/push/__init__.py +0 -0
  96. pubnub/endpoints/push/add_channels_to_push.py +111 -0
  97. pubnub/endpoints/push/list_push_provisions.py +103 -0
  98. pubnub/endpoints/push/remove_channels_from_push.py +109 -0
  99. pubnub/endpoints/push/remove_device.py +100 -0
  100. pubnub/endpoints/signal.py +60 -0
  101. pubnub/endpoints/time.py +37 -0
  102. pubnub/enums.py +174 -0
  103. pubnub/errors.py +67 -0
  104. pubnub/event_engine/__init__.py +0 -0
  105. pubnub/event_engine/dispatcher.py +44 -0
  106. pubnub/event_engine/manage_effects.py +326 -0
  107. pubnub/event_engine/models/__init__.py +0 -0
  108. pubnub/event_engine/models/effects.py +100 -0
  109. pubnub/event_engine/models/events.py +109 -0
  110. pubnub/event_engine/models/states.py +544 -0
  111. pubnub/event_engine/statemachine.py +117 -0
  112. pubnub/exceptions.py +20 -0
  113. pubnub/features.py +20 -0
  114. pubnub/managers.py +575 -0
  115. pubnub/models/__init__.py +0 -0
  116. pubnub/models/consumer/__init__.py +0 -0
  117. pubnub/models/consumer/access_manager.py +222 -0
  118. pubnub/models/consumer/channel_group.py +21 -0
  119. pubnub/models/consumer/common.py +23 -0
  120. pubnub/models/consumer/entities/__init__.py +0 -0
  121. pubnub/models/consumer/entities/membership.py +31 -0
  122. pubnub/models/consumer/entities/page.py +37 -0
  123. pubnub/models/consumer/entities/result.py +16 -0
  124. pubnub/models/consumer/entities/space.py +47 -0
  125. pubnub/models/consumer/entities/user.py +47 -0
  126. pubnub/models/consumer/file.py +60 -0
  127. pubnub/models/consumer/history.py +128 -0
  128. pubnub/models/consumer/message_actions.py +50 -0
  129. pubnub/models/consumer/message_count.py +12 -0
  130. pubnub/models/consumer/objects_v2/__init__.py +0 -0
  131. pubnub/models/consumer/objects_v2/channel.py +47 -0
  132. pubnub/models/consumer/objects_v2/channel_members.py +76 -0
  133. pubnub/models/consumer/objects_v2/memberships.py +88 -0
  134. pubnub/models/consumer/objects_v2/page.py +38 -0
  135. pubnub/models/consumer/objects_v2/sort.py +44 -0
  136. pubnub/models/consumer/objects_v2/uuid.py +47 -0
  137. pubnub/models/consumer/pn_error_data.py +7 -0
  138. pubnub/models/consumer/presence.py +161 -0
  139. pubnub/models/consumer/pubsub.py +138 -0
  140. pubnub/models/consumer/push.py +23 -0
  141. pubnub/models/consumer/signal.py +12 -0
  142. pubnub/models/consumer/time.py +20 -0
  143. pubnub/models/consumer/v3/__init__.py +0 -0
  144. pubnub/models/consumer/v3/access_manager.py +28 -0
  145. pubnub/models/consumer/v3/channel.py +44 -0
  146. pubnub/models/consumer/v3/group.py +24 -0
  147. pubnub/models/consumer/v3/pn_resource.py +45 -0
  148. pubnub/models/consumer/v3/space.py +48 -0
  149. pubnub/models/consumer/v3/user.py +48 -0
  150. pubnub/models/consumer/v3/uuid.py +28 -0
  151. pubnub/models/server/__init__.py +0 -0
  152. pubnub/models/server/subscribe.py +111 -0
  153. pubnub/models/subscription_item.py +7 -0
  154. pubnub/pnconfiguration.py +155 -0
  155. pubnub/pubnub.py +514 -0
  156. pubnub/pubnub_asyncio.py +813 -0
  157. pubnub/pubnub_core.py +713 -0
  158. pubnub/request_handlers/__init__.py +0 -0
  159. pubnub/request_handlers/base.py +20 -0
  160. pubnub/request_handlers/requests_handler.py +371 -0
  161. pubnub/structures.py +120 -0
  162. pubnub/utils.py +331 -0
  163. pubnub/workers.py +187 -0
@@ -0,0 +1,27 @@
1
+ PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks
2
+ Copyright (c) 2013 PubNub Inc.
3
+ http://www.pubnub.com/
4
+ http://www.pubnub.com/terms
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
23
+
24
+ PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks
25
+ Copyright (c) 2013 PubNub Inc.
26
+ http://www.pubnub.com/
27
+ http://www.pubnub.com/terms
@@ -0,0 +1,104 @@
1
+ Metadata-Version: 2.1
2
+ Name: freenub
3
+ Version: 0.1.0
4
+ Summary: This is a fork of pubnub when it still had an MIT license
5
+ Home-page: https://github.com/bdraco/freenub
6
+ License: MIT
7
+ Author: J. Nick Koston
8
+ Author-email: nick@koston.org
9
+ Requires-Python: >=3.8,<4.0
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.7
22
+ Classifier: Programming Language :: Python :: Implementation :: CPython
23
+ Classifier: Topic :: Internet :: WWW/HTTP
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Dist: aiohttp (>=3.9.5,<4.0.0)
26
+ Requires-Dist: cbor2 (>=5.6.4,<6.0.0)
27
+ Requires-Dist: pycryptodomex (>=3.3)
28
+ Requires-Dist: requests (>=2.4)
29
+ Project-URL: Bug Tracker, https://github.com/bdraco/freenub/issues
30
+ Project-URL: Changelog, https://github.com/bdraco/freenub/blob/main/CHANGELOG.md
31
+ Project-URL: Repository, https://github.com/bdraco/freenub
32
+ Description-Content-Type: text/markdown
33
+
34
+ # freenub
35
+
36
+ <p align="center">
37
+ <a href="https://github.com/bdraco/freenub/actions/workflows/ci.yml?query=branch%3Amain">
38
+ <img src="https://img.shields.io/github/actions/workflow/status/bdraco/freenub/ci.yml?branch=main&label=CI&logo=github&style=flat-square" alt="CI Status" >
39
+ </a>
40
+ <a href="https://codecov.io/gh/bdraco/freenub">
41
+ <img src="https://img.shields.io/codecov/c/github/bdraco/freenub.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
42
+ </a>
43
+ </p>
44
+ <p align="center">
45
+ <a href="https://python-poetry.org/">
46
+ <img src="https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json" alt="Poetry">
47
+ </a>
48
+ <a href="https://github.com/astral-sh/ruff">
49
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
50
+ </a>
51
+ <a href="https://github.com/pre-commit/pre-commit">
52
+ <img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
53
+ </a>
54
+ </p>
55
+ <p align="center">
56
+ <a href="https://pypi.org/project/freenub/">
57
+ <img src="https://img.shields.io/pypi/v/freenub.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPI Version">
58
+ </a>
59
+ <img src="https://img.shields.io/pypi/pyversions/freenub.svg?style=flat-square&logo=python&amp;logoColor=fff" alt="Supported Python versions">
60
+ <img src="https://img.shields.io/pypi/l/freenub.svg?style=flat-square" alt="License">
61
+ </p>
62
+
63
+ ---
64
+
65
+ **Source Code**: <a href="https://github.com/bdraco/freenub" target="_blank">https://github.com/bdraco/freenub </a>
66
+
67
+ ---
68
+
69
+ This is a fork of pubnub when it still had an MIT license
70
+
71
+ ## Installation
72
+
73
+ Install this via pip (or your favourite package manager):
74
+
75
+ `pip install freenub`
76
+
77
+ ## Usage
78
+
79
+ Start by importing it:
80
+
81
+ ```python
82
+ import freenub
83
+ ```
84
+
85
+ ## Contributors ✨
86
+
87
+ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
88
+
89
+ <!-- prettier-ignore-start -->
90
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
91
+ <!-- markdownlint-disable -->
92
+ <!-- markdownlint-enable -->
93
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
94
+ <!-- prettier-ignore-end -->
95
+
96
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
97
+
98
+ ## Credits
99
+
100
+ This package was created with
101
+ [Copier](https://copier.readthedocs.io/) and the
102
+ [browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template)
103
+ project template.
104
+
@@ -0,0 +1,163 @@
1
+ pubnub/__init__.py,sha256=brflg92m400QfgILsoTJHWIUWC1ge0py8tn8O2IM5fg,564
2
+ pubnub/builders.py,sha256=G-q4EyBXO4LPvauYOfcdDM03ilXsnVTXCVPttZe5JLM,2001
3
+ pubnub/callbacks.py,sha256=y_jmutgsw5ZkxgWhywGF8tmmNrsxibSBPG2jhlaZvBk,837
4
+ pubnub/crypto.py,sha256=_-cF1OOmyzKx96kYvTc9sjjq4I5A1q5spRZ9daX2Ppw,4377
5
+ pubnub/crypto_core.py,sha256=jSnH2pFT_Q5oDy_XeHG3nkciJR9-ginGn1CgFJDtCwg,186
6
+ pubnub/dtos.py,sha256=HbNr9Ot3ohh939c9ILhxOrbCzKlK8O-Z-zYUWm4UOZY,980
7
+ pubnub/endpoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ pubnub/endpoints/access/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ pubnub/endpoints/access/audit.py,sha256=pJZDADVLfSoc-wWJY-mPZ609GJdtsaBZ_ZV-NjC0Dpc,2186
10
+ pubnub/endpoints/access/grant.py,sha256=jGqmBbNEOiM5bnvjKgk86hK4eZliVLmHiyI5JwKRTis,5219
11
+ pubnub/endpoints/access/grant_token.py,sha256=s_OgkWA01tRhyhcU5u_Up4aTI6Z1WapdEoVR1bwK5w0,3603
12
+ pubnub/endpoints/access/revoke_token.py,sha256=ewL0maRyS8Brjs8l9D_NU7vN_1SYV03bwfbMuKfgTCE,1228
13
+ pubnub/endpoints/channel_groups/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ pubnub/endpoints/channel_groups/add_channel_to_channel_group.py,sha256=E5qeF6u_HxEUO-j2X0WleosWecBiCCogNuiHvTPJ1uw,2130
15
+ pubnub/endpoints/channel_groups/list_channels_in_channel_group.py,sha256=a8aHLIVfkYL_1GzlI6S2OaIyqG4Flu4cRB87fTOQhBA,1861
16
+ pubnub/endpoints/channel_groups/remove_channel_from_channel_group.py,sha256=Sk-KRIV-t5XJarNkVHR_mBj7pm-C-NvYUeBR0ReqxYo,2166
17
+ pubnub/endpoints/channel_groups/remove_channel_group.py,sha256=SIJgWOK1OGbaXJkz-E1P9AwzhtLAW_wdNbSScC8p2gQ,1694
18
+ pubnub/endpoints/endpoint.py,sha256=5wT0uRx63TbNe0LgPEHMnJxZNavyf3Ib8YyMj4r8oXw,10040
19
+ pubnub/endpoints/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ pubnub/endpoints/entities/endpoint.py,sha256=PvLwrZBVqFwbVr7zknG4AVQaNAOK37PjKQiVprz6d4I,6210
21
+ pubnub/endpoints/entities/membership/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
+ pubnub/endpoints/entities/membership/add_memberships.py,sha256=7S1WbLp6dJ1SlC_zwGICrKwe3qjLqwrFZGgBEiMCEI0,3277
23
+ pubnub/endpoints/entities/membership/fetch_memberships.py,sha256=kyP-G1zlr1vMhIwhWFC8iwz6AkrXzvrSJCByHmIfoDs,2122
24
+ pubnub/endpoints/entities/membership/remove_memberships.py,sha256=JglQWGo5SsjojkpC10vBYwyLUexJrleCE40rJ77AjLs,3158
25
+ pubnub/endpoints/entities/membership/update_memberships.py,sha256=XFBICEMBsJ-VEHiswIZKbncjGZaBZFXizaZG8m2HQpo,3301
26
+ pubnub/endpoints/entities/space/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
+ pubnub/endpoints/entities/space/create_space.py,sha256=x5r_7eY24CyrL5R01wHVBPqaq2tZWW3Ff-YUrjksRA8,2109
28
+ pubnub/endpoints/entities/space/fetch_space.py,sha256=Tznbgil52cRKq2FBfQXAE4A6-Zco3tDSy6-DZQ5_b7o,1043
29
+ pubnub/endpoints/entities/space/fetch_spaces.py,sha256=ZbAuju3mzRh2o-6B8SWgcQgnDGRktlKI-4jaJS7v_no,953
30
+ pubnub/endpoints/entities/space/remove_space.py,sha256=g62acNiFVqDLirVMWOyIq-r3GE-_sYHo8iqx8kLXKRg,946
31
+ pubnub/endpoints/entities/space/update_space.py,sha256=iSUzpj0kJl8UAbLBYN9ywbvZ6vYkfBOMLZofcFh2rJY,2109
32
+ pubnub/endpoints/entities/user/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
+ pubnub/endpoints/entities/user/create_user.py,sha256=yjFbT6f3kzS0NdUyQnxM9TfypbeOhPW1Ottmvd8-5EQ,2235
34
+ pubnub/endpoints/entities/user/fetch_user.py,sha256=szwWsagYiA2SHkZm8jwgEwwKYSU8xRkKKg4aEfVBzO4,1038
35
+ pubnub/endpoints/entities/user/fetch_users.py,sha256=Y9G0u6FZ_o_zbtp9a9M63bxKExOHEX3gKQCtzw8PIyk,905
36
+ pubnub/endpoints/entities/user/remove_user.py,sha256=RLzj4pP1c8unrEpjKl3RJJcb92XWkb5_7nV0-JRNmUw,941
37
+ pubnub/endpoints/entities/user/update_user.py,sha256=tj6SOqRBZGrmpJfU8aIjh0X9-Iu-TAFb30ewxeY_BCs,2235
38
+ pubnub/endpoints/fetch_messages.py,sha256=Qb3xBLjJJjbbj0cg3JePJQHrM9cbINc2OU0YlQFeoW8,6194
39
+ pubnub/endpoints/file_operations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
+ pubnub/endpoints/file_operations/delete_file.py,sha256=N-Dz5Z7pOfGVMiM67m3xdoHtdW9znla5LRegEDbZmV8,1432
41
+ pubnub/endpoints/file_operations/download_file.py,sha256=pNYOa9WzFG7VdR21obY3tr1B__BoClNpjERnkIjaaB8,2561
42
+ pubnub/endpoints/file_operations/download_file_asyncio.py,sha256=VMXR8-sNirSVaQpZMA53fxEHkRok_SSm1s3QV94LhKE,922
43
+ pubnub/endpoints/file_operations/fetch_upload_details.py,sha256=dBuegsSqhMi8cjbv7nALHAYf-3qOxPJr5EdGN5Dc5Ww,1444
44
+ pubnub/endpoints/file_operations/file_based_endpoint.py,sha256=QC3123iwfN2Gfr1W18r1kLnt72258nTl_X6SwdI2cOQ,452
45
+ pubnub/endpoints/file_operations/get_file_url.py,sha256=SCXQWPaHfJKwzRPOArTCHAQxEh_tLgeR6jr-0mpsGNU,2015
46
+ pubnub/endpoints/file_operations/list_files.py,sha256=jnfFQKGCf2w1NNl5h5fGvpQrl-uR71ytVqN4fLJion8,1049
47
+ pubnub/endpoints/file_operations/publish_file_message.py,sha256=9W0AvAQ9r33hU5YYD6s8AnWuTSobO03QyVrNPw9UWGk,3102
48
+ pubnub/endpoints/file_operations/send_file.py,sha256=jfX8P0E_ybEzXTVx3EZcKnuSgICbrg8Facfy6GOpCFI,4562
49
+ pubnub/endpoints/file_operations/send_file_asyncio.py,sha256=uHt3PqXLPSLznIuZm8yOdqJQmuj5pQsHrteHb0angnc,2018
50
+ pubnub/endpoints/history.py,sha256=-IdF71WXYTNbkDvmkfhoh1Vmm1RLO-zf8vRmuc1sio4,3226
51
+ pubnub/endpoints/history_delete.py,sha256=6zip2MRXCvfeng4ti-XU9izu_oi-6sK1YZxHnAsxJPY,1640
52
+ pubnub/endpoints/message_actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
+ pubnub/endpoints/message_actions/add_message_action.py,sha256=lbZ5sCy_WzkSVQrcMn3rY2lbgh1uJTV7tukkEX0Zs7c,2688
54
+ pubnub/endpoints/message_actions/get_message_actions.py,sha256=8CsOLeRQQrcY3tGLRsKrPP22yole_-hVVyF85TdsY48,2327
55
+ pubnub/endpoints/message_actions/remove_message_action.py,sha256=Gbhn5gYsUGXruqZEP2cre0QFWSnC_cE5qzSuizf9nwQ,2245
56
+ pubnub/endpoints/message_count.py,sha256=PNUlGyXCRPVo2luGuckrbWiuPqL57-WODA_AW3Ijn_o,2128
57
+ pubnub/endpoints/mixins.py,sha256=UR1CgQcF98_6oHk0v_WpxhMBqI-Cup4c_m33xV4uXIE,866
58
+ pubnub/endpoints/objects_v2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
+ pubnub/endpoints/objects_v2/channel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
+ pubnub/endpoints/objects_v2/channel/get_all_channels.py,sha256=5NhAUFXNnRLHmAwxh6N0Bz7WhKpbwttmzaelLLnoHoo,976
61
+ pubnub/endpoints/objects_v2/channel/get_channel.py,sha256=2nF7mANpk77Dz-38AZyAQoXvilyz1rSM9laX_xmRWBE,1082
62
+ pubnub/endpoints/objects_v2/channel/remove_channel.py,sha256=sAM3LpvXc6gcmU9AH94_U0UU_4fFBzUOKK5QZwwSeZs,1014
63
+ pubnub/endpoints/objects_v2/channel/set_channel.py,sha256=89QbZTrFvQOx2o95ep88rbPjRtNlHI-TOJ8e7eCLg6I,1672
64
+ pubnub/endpoints/objects_v2/members/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
65
+ pubnub/endpoints/objects_v2/members/get_channel_members.py,sha256=WDIqY8XeoztFXsw6WJRHjOYxTJbxzKvPgLqms5yACO0,1311
66
+ pubnub/endpoints/objects_v2/members/manage_channel_members.py,sha256=fpZ7_8YV_4M4DqEL98T2y3Rv7kkJT_co7nt5sS8HirQ,2060
67
+ pubnub/endpoints/objects_v2/members/remove_channel_members.py,sha256=NSijI5KhHR9QgolOR3z6xZ3GxfGOfNFO7sFZnst7YTI,1739
68
+ pubnub/endpoints/objects_v2/members/set_channel_members.py,sha256=utRflGhwXZpZny1zyyqeLgefPjLZVB_6MI5_iKMfva0,1697
69
+ pubnub/endpoints/objects_v2/memberships/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
70
+ pubnub/endpoints/objects_v2/memberships/get_memberships.py,sha256=GuK9fCc3hyQoGmVg5LnacQ6lJhbKgUmVLjR0eDS1gLU,1286
71
+ pubnub/endpoints/objects_v2/memberships/manage_memberships.py,sha256=9kp8U4vRQcCAwQ0-aFoQxcbAJI1bGCCqFaO3sgnTSw4,2338
72
+ pubnub/endpoints/objects_v2/memberships/remove_memberships.py,sha256=SY0qPr37iGBe2jmnNaVXwQsvGNWlnppF_4Uq1632YDU,1859
73
+ pubnub/endpoints/objects_v2/memberships/set_memberships.py,sha256=nuH-FD130xGYlBKqsL33z_j8XrqJDTPf0FLZovU_Wi8,1824
74
+ pubnub/endpoints/objects_v2/objects_endpoint.py,sha256=0LYP6LaTNELSSu3NNyMAslTGH_PyuJmlN0gsqF54WH8,5730
75
+ pubnub/endpoints/objects_v2/uuid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
+ pubnub/endpoints/objects_v2/uuid/get_all_uuid.py,sha256=HfTg3ETUt-GiJ81nB8VTQGCpnvUza5Wq7LzklC84XlE,940
77
+ pubnub/endpoints/objects_v2/uuid/get_uuid.py,sha256=_ayt1MBditMiIbGM3qTb3zQGPT4Q4PEPlwe9xz8RjTA,1047
78
+ pubnub/endpoints/objects_v2/uuid/remove_uuid.py,sha256=OvRY-Nz1T3_uKmhV1yMueaV9mktQ5PRnz1ZSwkBttcc,966
79
+ pubnub/endpoints/objects_v2/uuid/set_uuid.py,sha256=nUgfLkStzm8qtoJ1xZxHvhtNrpEb7wNtEoOpkrkB7DI,1966
80
+ pubnub/endpoints/presence/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
81
+ pubnub/endpoints/presence/get_state.py,sha256=kG2nz2sPd3aSYISSXLc89z-c3H0u6lC5i0I2qsCP_u0,2276
82
+ pubnub/endpoints/presence/heartbeat.py,sha256=ZsUVguR-hAZBqnW8gLjMnS_Y1vMZxf-gHXWUrH0o6Ts,2192
83
+ pubnub/endpoints/presence/here_now.py,sha256=uOX5w-GEVvYP8kenJIzUFn_FPlAHT5bWdwB01-5tUHg,2301
84
+ pubnub/endpoints/presence/leave.py,sha256=x0h2abWUjxKN5MMZv3z3_7LeYQhXdZcpLmAQRfXYBj8,2167
85
+ pubnub/endpoints/presence/set_state.py,sha256=QTN2U-EnMrW6azEaNacDDhGEX-SBAH6D8xLw-xwpup8,3160
86
+ pubnub/endpoints/presence/where_now.py,sha256=LYsz0YpO7uDvyviBhEo_QFfexS1oNQ6uBbXzcQDmEho,1412
87
+ pubnub/endpoints/pubsub/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
+ pubnub/endpoints/pubsub/fire.py,sha256=at0-IQzDpNkQvhsBQxryQ3VT1XlGTfvsoox4N-ruaOU,4198
89
+ pubnub/endpoints/pubsub/publish.py,sha256=SLnN66e-fq9Pm64l-refZyE5HGly_ZPulAkAFD7Noh8,5007
90
+ pubnub/endpoints/pubsub/subscribe.py,sha256=5VKi7sOXIi3EH3NHr9T_2kkd84U7okYabuEOsnqxyqI,2752
91
+ pubnub/endpoints/push/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
92
+ pubnub/endpoints/push/add_channels_to_push.py,sha256=5dj2fGzBjQ0Qjm3xwtJR__0_ye5DLVtHbmobW4hdIlQ,3404
93
+ pubnub/endpoints/push/list_push_provisions.py,sha256=HPaoA33zBLDhTqrZ5g3CXPzwRB59RiWBmMEgLZfgzK0,3235
94
+ pubnub/endpoints/push/remove_channels_from_push.py,sha256=nGRGwrhB95fahDPcUwPpp_WJjNgkFKpRhNNiL6n3jxQ,3431
95
+ pubnub/endpoints/push/remove_device.py,sha256=JXxoFQsTNRxiXvduDohex0g5RO5fHJ9YcpV-x_7zRH8,3118
96
+ pubnub/endpoints/signal.py,sha256=z7UuDZLhrnQz_bvqEUM0sxPKfrNAHuyWbkgkw7rf2o4,1613
97
+ pubnub/endpoints/time.py,sha256=PeZJ5DTq0_SwsuMJFBPjr7xxrrvORJT6RxuhocIRHG8,848
98
+ pubnub/enums.py,sha256=r2BYDGlqqdvekVnMfWXxXQGdavvT_rwRbcXU-FcqJyw,4173
99
+ pubnub/errors.py,sha256=wYsybC3u3jES2GBTzzvJ520iwQ4dHFQ8aAk1xf12C1o,3223
100
+ pubnub/event_engine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
101
+ pubnub/event_engine/dispatcher.py,sha256=2zTs8vzg-E-6iqRjS3v7CFuEPfTTP1XY8xmW8QB9FW0,1626
102
+ pubnub/event_engine/manage_effects.py,sha256=mPNrS3CBzUgGEl0mpdKuj7Mz55yYeQNBO2qqv5qBq5s,11976
103
+ pubnub/event_engine/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
104
+ pubnub/event_engine/models/effects.py,sha256=Ch5jPIzYmNEcGzLChqUraopsU2iRQKTM0vZ0horrQcM,2432
105
+ pubnub/event_engine/models/events.py,sha256=C9VkltW_Zxh4x3npkmUAyBI0-zMLVFb1y6jDndY70_k,2527
106
+ pubnub/event_engine/models/states.py,sha256=5uGe0T2NmsGNo8FDJvmbQV8pWxp1H3iGEikbU-CjEaA,19162
107
+ pubnub/event_engine/statemachine.py,sha256=heO2Yk3m6-iMC5y6deo66EysTBY3OeTCda52hBQrUhk,3987
108
+ pubnub/exceptions.py,sha256=YQzMe0GWX4GcmtUn4c-eMbCubwlpWxzRfFstBPUSaiI,661
109
+ pubnub/features.py,sha256=MP6KSFbOG-d0_eowxUnJXE_KScQpNDis7-O5gUmdZKA,506
110
+ pubnub/managers.py,sha256=8WrS5xjDDo1eaN3dss3aXes8kDkkEIj-4lcC0b9LWVg,19942
111
+ pubnub/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
112
+ pubnub/models/consumer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
113
+ pubnub/models/consumer/access_manager.py,sha256=_zUh5P3POz_gJgv4i0-TdFlYx8tGkQXGn4H83teG7BY,6259
114
+ pubnub/models/consumer/channel_group.py,sha256=4CUG8ZNr-NdwlX13PoBt0ICUxYcC1Q3HvL5bTU3FnRE,536
115
+ pubnub/models/consumer/common.py,sha256=bAA1-3V-6tCCcl_hBYQg3IsUD4nThKD1m_sGNK0YpR4,545
116
+ pubnub/models/consumer/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
117
+ pubnub/models/consumer/entities/membership.py,sha256=XRrUZYXIfVkV_FOjvhzR9pjBSTLuXMLtpDnfOaib7ss,912
118
+ pubnub/models/consumer/entities/page.py,sha256=oig6kkD8Zkxmgh6uRlvot87a_kf220VbWStcDg6l6gw,745
119
+ pubnub/models/consumer/entities/result.py,sha256=nR5WCY-cQbVDRo0lIhtwcOepbcHbXmAXOGBhnPGTsMg,441
120
+ pubnub/models/consumer/entities/space.py,sha256=KNZbWLngMF2vzlUS1uBkwpL-vsihczIr29yc3nCY5gw,1104
121
+ pubnub/models/consumer/entities/user.py,sha256=svR_dV1XP6EOqRYAVptzZMmr3U6xgUrispV5bi1qe4U,1083
122
+ pubnub/models/consumer/file.py,sha256=4fHBpEsO10aeBkpk2xx46XHdT2vU-MUdSQSqIchsWAY,1704
123
+ pubnub/models/consumer/history.py,sha256=o1KSOIWMXObPAJGKLFVMuMVhq7wZi7QS17Qx-KYRROE,3774
124
+ pubnub/models/consumer/message_actions.py,sha256=7IQhBQtI_G7by3hFl9pvxPSDqS4PJQvvOmdEtAWBZgk,1539
125
+ pubnub/models/consumer/message_count.py,sha256=WAz7bB5bHEO7ij2Z7squE2oGU6OgrE0pJumXsgNT_DQ,357
126
+ pubnub/models/consumer/objects_v2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
127
+ pubnub/models/consumer/objects_v2/channel.py,sha256=FNvWPwv2ySvejIW7_5aoDjdJrih8w-5qjjJLFjoM-ys,1224
128
+ pubnub/models/consumer/objects_v2/channel_members.py,sha256=SjC1MvRFLYBMHnN1kWUq4xOf-d3WVMeQIFE6woO2EsI,1941
129
+ pubnub/models/consumer/objects_v2/memberships.py,sha256=gtDqrMI4EsHltpbuspFNbT8kjwaDmEB4pc1YWRkK8eA,2324
130
+ pubnub/models/consumer/objects_v2/page.py,sha256=pipyOuzJjiWTjmrVu2N2_w2_HJBirOFbKDigQKg2TVE,765
131
+ pubnub/models/consumer/objects_v2/sort.py,sha256=OhWlSBHtWK6yFhlANu7_4R_kS0L0G3Fh-JCEcnIURYo,1068
132
+ pubnub/models/consumer/objects_v2/uuid.py,sha256=ydc0-ynK0WzSSw6nWc31PtVxuhoGW8LuvncHkOE9jyw,1194
133
+ pubnub/models/consumer/pn_error_data.py,sha256=KGp7OsxhW66bt3Ft1e9xzhY8NsXhwf8syEwc-4Iz9qA,234
134
+ pubnub/models/consumer/presence.py,sha256=Jh3Vfj5qsCmrSS1kilXBwZrJR6ZVF2ocDFGqs7DU7l0,5597
135
+ pubnub/models/consumer/pubsub.py,sha256=Se0IbSklIaQ0FIjZbtwnwqJQVldDMWOYDP71D6ZpcKA,3594
136
+ pubnub/models/consumer/push.py,sha256=kWg7at0vqtS3E6oNrjeGzS6GVIMnAOsiNXKORYKctXg,559
137
+ pubnub/models/consumer/signal.py,sha256=TVd8-LqluI1FSKLGMualBkvunf67SU0VRWtRVvnhwG8,334
138
+ pubnub/models/consumer/time.py,sha256=st3PgQswKYdsv488IQnSUS9uMWqWpQd9FWkZ4tn9VZ0,540
139
+ pubnub/models/consumer/v3/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
140
+ pubnub/models/consumer/v3/access_manager.py,sha256=t0VVRZH8X26FyxYvKAzIOeLZ04OyQmnAq8KruhUZVJ0,581
141
+ pubnub/models/consumer/v3/channel.py,sha256=lkxaYHGStiyezuh_5y1KIhl1QCgQyyNnjz4IzOdT9Uo,950
142
+ pubnub/models/consumer/v3/group.py,sha256=kFmnEBLRmTq1ZcED7MSZEVs-pzE_C9RKVKuCi2OcCTs,585
143
+ pubnub/models/consumer/v3/pn_resource.py,sha256=_Mnc81CkWS0FIIM4cPS6EIngskZpMfevAhtluO9NQk4,1045
144
+ pubnub/models/consumer/v3/space.py,sha256=btctYXmVU1LhmVQwyiq2NzzCv5x0LsT7Q5ccuAaKFWk,999
145
+ pubnub/models/consumer/v3/user.py,sha256=9GXxvZrbvsPXDMpNeuUrTslq8TDOvMsmxZM7KcbWHBc,988
146
+ pubnub/models/consumer/v3/uuid.py,sha256=2KZKN015qN2jjIuZ49AQFJugCi3LM51J4Zr-WX-XjrA,643
147
+ pubnub/models/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
148
+ pubnub/models/server/subscribe.py,sha256=9BEGkFDdMSvLP3XmKf7lIXW_Wy2paBfuUq3TlFu6reM,3458
149
+ pubnub/models/subscription_item.py,sha256=QCXEyGbEVr4bfXoCMstT6kQijQG2COQ9u9iL_iYimAE,172
150
+ pubnub/pnconfiguration.py,sha256=Ey-jI1TFsp8vBNPVKikJeV-q0DYavoCjd_3uv5YvYVg,4797
151
+ pubnub/pubnub.py,sha256=uC5ydY1v6-1tD_3iJcnj9RB30Pf-kz8va7QTYaxNrZA,16881
152
+ pubnub/pubnub_asyncio.py,sha256=K3k02fRFxzDDD6VR7ptk_DhoDRAvzU243qhNuQ74KjY,27489
153
+ pubnub/pubnub_core.py,sha256=9u4lodqie0V57TkZ9hDiSpOEyuin3e_2EUMgnBLSgX0,20787
154
+ pubnub/request_handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
155
+ pubnub/request_handlers/base.py,sha256=35gfv6om-94C34r-6fBfShCsTwcLjjKxvKdDYbTSK14,403
156
+ pubnub/request_handlers/requests_handler.py,sha256=eGo2c6Gfs_dWXsgzPqvK38AQxW9IhRvN2-O1BiHoWcQ,12187
157
+ pubnub/structures.py,sha256=KZQgKJTfJ3DAzjb7VE1JN3HYb_hvcw3i1dlaTlStsyA,3231
158
+ pubnub/utils.py,sha256=xRJ6ppAR3C5lM_IZAwDdVMpbxXRBh2olhlOt6PpEhUo,8388
159
+ pubnub/workers.py,sha256=QcP6oy3CqFXsXolX3jG1Cqg9JSqvtOWlvuFU9EgiSFo,7675
160
+ freenub-0.1.0.dist-info/LICENSE,sha256=nC_bHbTp3aoeznYRBK_VAkSSLYKD0jmjcSfZo5qA4Xs,1347
161
+ freenub-0.1.0.dist-info/METADATA,sha256=IwltotlLtMq5X3qPproZwExQDeZ1RZ8vLn8tY35I_EQ,3986
162
+ freenub-0.1.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
163
+ freenub-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 1.9.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
pubnub/__init__.py ADDED
@@ -0,0 +1,21 @@
1
+ import logging
2
+ import os
3
+
4
+ PUBNUB_ROOT = os.path.dirname(os.path.abspath(__file__))
5
+
6
+ __version__ = "0.1.0"
7
+
8
+
9
+ def set_stream_logger(
10
+ name="pubnub", level=logging.ERROR, format_string=None, stream=None
11
+ ):
12
+ if format_string is None:
13
+ format_string = "%(asctime)s %(name)s [%(levelname)s] %(message)s"
14
+
15
+ logger = logging.getLogger(name)
16
+ logger.setLevel(level)
17
+ handler = logging.StreamHandler(stream)
18
+ handler.setLevel(level)
19
+ formatter = logging.Formatter(format_string)
20
+ handler.setFormatter(formatter)
21
+ logger.addHandler(handler)
pubnub/builders.py ADDED
@@ -0,0 +1,69 @@
1
+ from abc import ABCMeta, abstractmethod
2
+
3
+ from . import utils
4
+ from .dtos import SubscribeOperation, UnsubscribeOperation
5
+
6
+
7
+ class PubSubBuilder:
8
+ __metaclass__ = ABCMeta
9
+
10
+ def __init__(self, subscription_manager):
11
+ self._subscription_manager = subscription_manager
12
+ self._channel_subscriptions = []
13
+ self._channel_group_subscriptions = []
14
+
15
+ # TODO: make the 'channel' alias
16
+ def channels(self, channels_list):
17
+ utils.extend_list(self._channel_subscriptions, channels_list)
18
+
19
+ return self
20
+
21
+ def channel_groups(self, channel_groups_list):
22
+ utils.extend_list(self._channel_group_subscriptions, channel_groups_list)
23
+
24
+ return self
25
+
26
+ @abstractmethod
27
+ def execute(self):
28
+ pass
29
+
30
+
31
+ class SubscribeBuilder(PubSubBuilder):
32
+ def __init__(self, subscription_manager):
33
+ super().__init__(subscription_manager)
34
+ self._presence_enabled = False
35
+ self._timetoken = 0
36
+
37
+ def with_presence(self):
38
+ self._presence_enabled = True
39
+ return self
40
+
41
+ def with_timetoken(self, timetoken):
42
+ self._timetoken = timetoken
43
+ return self
44
+
45
+ def channel_subscriptions(self):
46
+ return self._channel_subscriptions
47
+
48
+ def channel_group_subscriptions(self):
49
+ return self._channel_group_subscriptions
50
+
51
+ def execute(self):
52
+ subscribe_operation = SubscribeOperation(
53
+ channels=self._channel_subscriptions,
54
+ channel_groups=self._channel_group_subscriptions,
55
+ timetoken=self._timetoken,
56
+ presence_enabled=self._presence_enabled,
57
+ )
58
+
59
+ self._subscription_manager.adapt_subscribe_builder(subscribe_operation)
60
+
61
+
62
+ class UnsubscribeBuilder(PubSubBuilder):
63
+ def execute(self):
64
+ unsubscribe_operation = UnsubscribeOperation(
65
+ channels=self._channel_subscriptions,
66
+ channel_groups=self._channel_group_subscriptions,
67
+ )
68
+
69
+ self._subscription_manager.adapt_unsubscribe_builder(unsubscribe_operation)
pubnub/callbacks.py ADDED
@@ -0,0 +1,47 @@
1
+ from abc import ABCMeta, abstractmethod
2
+
3
+
4
+ class PNCallback:
5
+ @abstractmethod
6
+ def on_response(self, x, status):
7
+ pass
8
+
9
+
10
+ class SubscribeCallback:
11
+ __metaclass__ = ABCMeta
12
+
13
+ @abstractmethod
14
+ def status(self, pubnub, status):
15
+ pass
16
+
17
+ @abstractmethod
18
+ def message(self, pubnub, message):
19
+ pass
20
+
21
+ @abstractmethod
22
+ def presence(self, pubnub, presence):
23
+ pass
24
+
25
+ def signal(self, pubnub, signal):
26
+ pass
27
+
28
+ def channel(self, pubnub, channel):
29
+ pass
30
+
31
+ def uuid(self, pubnub, uuid):
32
+ pass
33
+
34
+ def membership(self, pubnub, membership):
35
+ pass
36
+
37
+ def message_action(self, pubnub, message_action):
38
+ pass
39
+
40
+ def file(self, pubnub, file_message):
41
+ pass
42
+
43
+
44
+ class ReconnectionCallback:
45
+ @abstractmethod
46
+ def on_reconnect(self):
47
+ pass
pubnub/crypto.py ADDED
@@ -0,0 +1,125 @@
1
+ import hashlib
2
+ import json
3
+ import random
4
+ from base64 import decodebytes, encodebytes
5
+
6
+ from Cryptodome.Cipher import AES
7
+ from Cryptodome.Util.Padding import pad, unpad
8
+
9
+ from pubnub.crypto_core import PubNubCrypto
10
+
11
+ Initial16bytes = "0123456789012345"
12
+
13
+
14
+ class PubNubCryptodome(PubNubCrypto):
15
+ mode = AES.MODE_CBC
16
+ fallback_mode = None
17
+
18
+ def __init__(self, pubnub_config):
19
+ self.pubnub_configuration = pubnub_config
20
+ self.mode = pubnub_config.cipher_mode
21
+ self.fallback_mode = pubnub_config.fallback_cipher_mode
22
+
23
+ def encrypt(self, key, msg, use_random_iv=False):
24
+ secret = self.get_secret(key)
25
+ initialization_vector = self.get_initialization_vector(use_random_iv)
26
+
27
+ cipher = AES.new(
28
+ bytes(secret[0:32], "utf-8"),
29
+ self.mode,
30
+ bytes(initialization_vector, "utf-8"),
31
+ )
32
+ encrypted_message = cipher.encrypt(self.pad(msg.encode("utf-8")))
33
+ msg_with_iv = self.append_random_iv(
34
+ encrypted_message, use_random_iv, bytes(initialization_vector, "utf-8")
35
+ )
36
+
37
+ return encodebytes(msg_with_iv).decode("utf-8").replace("\n", "")
38
+
39
+ def decrypt(self, key, msg, use_random_iv=False):
40
+ secret = self.get_secret(key)
41
+
42
+ decoded_message = decodebytes(msg.encode("utf-8"))
43
+ initialization_vector, extracted_message = self.extract_random_iv(
44
+ decoded_message, use_random_iv
45
+ )
46
+ cipher = AES.new(bytes(secret[0:32], "utf-8"), self.mode, initialization_vector)
47
+ try:
48
+ plain = self.depad((cipher.decrypt(extracted_message)).decode("utf-8"))
49
+ except UnicodeDecodeError as e:
50
+ if not self.fallback_mode:
51
+ raise e
52
+
53
+ cipher = AES.new(
54
+ bytes(secret[0:32], "utf-8"), self.fallback_mode, initialization_vector
55
+ )
56
+ plain = self.depad((cipher.decrypt(extracted_message)).decode("utf-8"))
57
+
58
+ try:
59
+ return json.loads(plain)
60
+ except Exception:
61
+ return plain
62
+
63
+ def append_random_iv(self, message, use_random_iv, initialization_vector):
64
+ if self.pubnub_configuration.use_random_initialization_vector or use_random_iv:
65
+ return initialization_vector + message
66
+ else:
67
+ return message
68
+
69
+ def extract_random_iv(self, message, use_random_iv):
70
+ if self.pubnub_configuration.use_random_initialization_vector or use_random_iv:
71
+ return message[0:16], message[16:]
72
+ else:
73
+ return bytes(Initial16bytes, "utf-8"), message
74
+
75
+ def get_initialization_vector(self, use_random_iv):
76
+ if self.pubnub_configuration.use_random_initialization_vector or use_random_iv:
77
+ return f"{random.randint(0, 9999999999999999):016}"
78
+ else:
79
+ return Initial16bytes
80
+
81
+ def pad(self, msg, block_size=16):
82
+ padding = block_size - (len(msg) % block_size)
83
+ return msg + (chr(padding) * padding).encode("utf-8")
84
+
85
+ def depad(self, msg):
86
+ return msg[0 : -ord(msg[-1])]
87
+
88
+ def get_secret(self, key):
89
+ return hashlib.sha256(key.encode("utf-8")).hexdigest()
90
+
91
+
92
+ class PubNubFileCrypto(PubNubCryptodome):
93
+ def encrypt(self, key, file):
94
+ secret = self.get_secret(key)
95
+ initialization_vector = self.get_initialization_vector(use_random_iv=True)
96
+ cipher = AES.new(
97
+ bytes(secret[0:32], "utf-8"),
98
+ self.mode,
99
+ bytes(initialization_vector, "utf-8"),
100
+ )
101
+ initialization_vector = bytes(initialization_vector, "utf-8")
102
+
103
+ return self.append_random_iv(
104
+ cipher.encrypt(pad(file, 16)),
105
+ use_random_iv=True,
106
+ initialization_vector=initialization_vector,
107
+ )
108
+
109
+ def decrypt(self, key, file):
110
+ secret = self.get_secret(key)
111
+ initialization_vector, extracted_file = self.extract_random_iv(
112
+ file, use_random_iv=True
113
+ )
114
+ try:
115
+ cipher = AES.new(
116
+ bytes(secret[0:32], "utf-8"), self.mode, initialization_vector
117
+ )
118
+ result = unpad(cipher.decrypt(extracted_file), 16)
119
+ except ValueError:
120
+ cipher = AES.new(
121
+ bytes(secret[0:32], "utf-8"), self.fallback_mode, initialization_vector
122
+ )
123
+ result = unpad(cipher.decrypt(extracted_file), 16)
124
+
125
+ return result
pubnub/crypto_core.py ADDED
@@ -0,0 +1,11 @@
1
+ from abc import abstractmethod
2
+
3
+
4
+ class PubNubCrypto:
5
+ @abstractmethod
6
+ def encrypt(self, key, msg):
7
+ pass
8
+
9
+ @abstractmethod
10
+ def decrypt(self, key, msg):
11
+ pass
pubnub/dtos.py ADDED
@@ -0,0 +1,29 @@
1
+ class SubscribeOperation:
2
+ def __init__(
3
+ self, channels=None, channel_groups=None, presence_enabled=None, timetoken=None
4
+ ):
5
+ assert isinstance(channels, (list, tuple))
6
+ assert isinstance(channel_groups, (list, tuple))
7
+ assert isinstance(presence_enabled, bool)
8
+ assert isinstance(timetoken, int)
9
+
10
+ self.channels = channels
11
+ self.channel_groups = channel_groups
12
+ self.presence_enabled = presence_enabled
13
+ self.timetoken = timetoken
14
+
15
+
16
+ class UnsubscribeOperation:
17
+ def __init__(self, channels=None, channel_groups=None):
18
+ assert isinstance(channels, (list, tuple))
19
+ assert isinstance(channel_groups, (list, tuple))
20
+
21
+ self.channels = channels
22
+ self.channel_groups = channel_groups
23
+
24
+
25
+ class StateOperation:
26
+ def __init__(self, channels=None, channel_groups=None, state=None):
27
+ self.channels = channels
28
+ self.channel_groups = channel_groups
29
+ self.state = state
File without changes
File without changes