Skip to content

Commit 62b44ef

Browse files
PubNub SDK v4.8.1 release.
1 parent 14557a4 commit 62b44ef

File tree

10 files changed

+16930
-15
lines changed

10 files changed

+16930
-15
lines changed

.pubnub.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
name: python
2-
version: 4.8.0
2+
version: 4.8.1
33
schema: 1
44
scm: github.com/pubnub/python
55
changelog:
6+
- version: v4.8.1
7+
date: Jan 18, 2021
8+
changes:
9+
-
10+
text: "New v3 History endpoint allows to fetch 100 messages per channel."
11+
type: feature
612
- version: v4.8.0
713
date: Dec 9, 2020
814
changes:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [v4.8.1](https://github.com/pubnub/python/releases/tag/v4.8.1)
2+
3+
[Full Changelog](https://github.com/pubnub/python/compare/v4.8.0...v4.8.1)
4+
5+
- 🌟️ New v3 History endpoint allows to fetch 100 messages per channel.
6+
17
## [v4.8.0](https://github.com/pubnub/python/releases/tag/v4.8.0)
28

39
[Full Changelog](https://github.com/pubnub/python/compare/v4...v4.8.0)

pubnub/endpoints/fetch_messages.py

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ class FetchMessages(Endpoint):
1616
FETCH_MESSAGES_PATH = "/v3/history/sub-key/%s/channel/%s"
1717
FETCH_MESSAGES_WITH_ACTIONS_PATH = "/v3/history-with-actions/sub-key/%s/channel/%s"
1818

19-
DEFAULT_MESSAGES = 25
20-
MAX_MESSAGES = 25
21-
MAX_MESSAGES_ACTIONS = 100
19+
SINGLE_CHANNEL_MAX_MESSAGES = 100
20+
DEFAULT_SINGLE_CHANNEL_MESSAGES = 100
21+
22+
MULTIPLE_CHANNELS_MAX_MESSAGES = 25
23+
DEFAULT_MULTIPLE_CHANNELS_MESSAGES = 25
24+
25+
MAX_MESSAGES_ACTIONS = 25
26+
DEFAULT_MESSAGES_ACTIONS = 25
2227

2328
def __init__(self, pubnub):
2429
Endpoint.__init__(self, pubnub)
@@ -105,21 +110,29 @@ def validate_params(self):
105110
if self._include_message_actions is None:
106111
self._include_message_actions = False
107112

108-
if self._include_message_actions is False:
109-
if self._count is None or self._count < 1:
110-
self._count = FetchMessages.DEFAULT_MESSAGES
111-
logger.info("count param defaulting to %d", FetchMessages.DEFAULT_MESSAGES)
112-
elif self._count > FetchMessages.MAX_MESSAGES:
113-
self._count = FetchMessages.MAX_MESSAGES
114-
logger.info("count param defaulting to %d", FetchMessages.MAX_MESSAGES)
113+
if not self._include_message_actions:
114+
if len(self._channels) == 1:
115+
if self._count is None or self._count < 1:
116+
self._count = FetchMessages.DEFAULT_SINGLE_CHANNEL_MESSAGES
117+
logger.info("count param defaulting to %d", self._count)
118+
elif self._count > FetchMessages.SINGLE_CHANNEL_MAX_MESSAGES:
119+
self._count = FetchMessages.DEFAULT_SINGLE_CHANNEL_MESSAGES
120+
logger.info("count param defaulting to %d", self._count)
121+
else:
122+
if self._count is None or self._count < 1:
123+
self._count = FetchMessages.DEFAULT_MULTIPLE_CHANNELS_MESSAGES
124+
logger.info("count param defaulting to %d", self._count)
125+
elif self._count > FetchMessages.MULTIPLE_CHANNELS_MAX_MESSAGES:
126+
self._count = FetchMessages.DEFAULT_MULTIPLE_CHANNELS_MESSAGES
127+
logger.info("count param defaulting to %d", self._count)
115128
else:
116129
if len(self._channels) > 1:
117130
raise PubNubException(pn_error=PNERR_HISTORY_MESSAGE_ACTIONS_MULTIPLE_CHANNELS)
118131

119132
if self._count is None or self._count < 1 or\
120133
self._count > FetchMessages.MAX_MESSAGES_ACTIONS:
121-
self._count = FetchMessages.MAX_MESSAGES_ACTIONS
122-
logger.info("count param defaulting to %d", FetchMessages.MAX_MESSAGES_ACTIONS)
134+
self._count = FetchMessages.DEFAULT_MESSAGES_ACTIONS
135+
logger.info("count param defaulting to %d", self._count)
123136

124137
def create_response(self, envelope): # pylint: disable=W0221
125138
return PNFetchMessagesResult.from_json(

pubnub/pubnub_core.py

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

6666
class PubNubCore:
6767
"""A base class for PubNub Python API implementations"""
68-
SDK_VERSION = "4.8.0"
68+
SDK_VERSION = "4.8.1"
6969
SDK_NAME = "PubNub-Python"
7070

7171
TIMESTAMP_DIVIDER = 1000

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.8.0',
5+
version='4.8.1',
66
description='PubNub Real-time push service in the cloud',
77
author='PubNub',
88
author_email='[email protected]',

0 commit comments

Comments
 (0)