Skip to content

Commit 4e071ee

Browse files
PubNub SDK v4.5.4 release.
1 parent cd4f759 commit 4e071ee

File tree

7 files changed

+37
-5
lines changed

7 files changed

+37
-5
lines changed

.pubnub.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
name: python
2-
version: 4.5.3
2+
version: 4.5.4
33
schema: 1
44
scm: github.com/pubnub/python
55
changelog:
6+
- version: v4.5.4
7+
date: Sep 29, 2020
8+
changes:
9+
-
10+
text: "Add `suppress_leave_events` configuration option which can be used to opt-out presence leave call on unsubscribe."
11+
type: feature
12+
-
13+
text: "Log out message decryption error and pass received message with `PNDecryptionErrorCategory` category to status listeners."
14+
type: improvement
615
- version: v4.5.3
716
date: Aug 10, 2020
817
changes:

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## [v4.5.4](https://github.com/pubnub/python/releases/tag/v4.5.4)
2+
3+
[Full Changelog](https://github.com/pubnub/python/compare/v4.5.3...v4.5.4)
4+
5+
- 🌟️ Add `suppress_leave_events` configuration option which can be used to opt-out presence leave call on unsubscribe.
6+
- ⭐️️ Log out message decryption error and pass received message with `PNDecryptionErrorCategory` category to status listeners.
7+
18
## [v4.5.3](https://github.com/pubnub/python/releases/tag/v4.5.3)
29

310
[Full Changelog](https://github.com/pubnub/python/compare/v4.5.2...v4.5.3)

pubnub/managers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ def adapt_unsubscribe_builder(self, unsubscribe_operation):
316316

317317
self._subscription_state.adapt_unsubscribe_builder(unsubscribe_operation)
318318

319-
self._send_leave(unsubscribe_operation)
319+
if not self._pubnub.config.suppress_leave_events:
320+
self._send_leave(unsubscribe_operation)
320321

321322
if self._subscription_state.is_empty():
322323
self._region = None

pubnub/pnconfiguration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def __init__(self):
2828
self.reconnect_policy = PNReconnectionPolicy.NONE
2929
self.daemon = False
3030
self.disable_token_manager = False
31+
self.suppress_leave_events = False
3132

3233
self.heartbeat_default_values = True
3334
self._presence_timeout = PNConfiguration.DEFAULT_PRESENCE_TIMEOUT

pubnub/pubnub_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
class PubNubCore:
5858
"""A base class for PubNub Python API implementations"""
59-
SDK_VERSION = "4.5.3"
59+
SDK_VERSION = "4.5.4"
6060
SDK_NAME = "PubNub-Python"
6161

6262
TIMESTAMP_DIVIDER = 1000

pubnub/workers.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import logging
22

33
from abc import abstractmethod
4+
5+
from .enums import PNStatusCategory, PNOperationType
6+
from .models.consumer.common import PNStatus
7+
from .models.consumer.pn_error_data import PNErrorData
48
from .utils import strip_right
59
from .models.consumer.pubsub import PNPresenceEventResult, PNMessageResult, PNSignalMessageResult, PNMessageActionResult
610
from .models.server.subscribe import SubscribeMessage, PresenceEnvelope
@@ -39,7 +43,17 @@ def _process_message(self, message_input):
3943
if self._pubnub.config.cipher_key is None:
4044
return message_input
4145
else:
42-
return self._pubnub.config.crypto.decrypt(self._pubnub.config.cipher_key, message_input)
46+
try:
47+
return self._pubnub.config.crypto.decrypt(self._pubnub.config.cipher_key, message_input)
48+
except Exception as exception:
49+
logger.warning("could not decrypt message: \"%s\", due to error %s" % (message_input, str(exception)))
50+
pn_status = PNStatus()
51+
pn_status.category = PNStatusCategory.PNDecryptionErrorCategory
52+
pn_status.error_data = PNErrorData(str(exception), exception)
53+
pn_status.error = True
54+
pn_status.operation = PNOperationType.PNSubscribeOperation
55+
self._listener_manager.announce_status(pn_status)
56+
return message_input
4357

4458
def _process_incoming_payload(self, message):
4559
assert isinstance(message, SubscribeMessage)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='pubnub',
5-
version='4.5.3',
5+
version='4.5.4',
66
description='PubNub Real-time push service in the cloud',
77
author='PubNub',
88
author_email='[email protected]',

0 commit comments

Comments
 (0)