Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions 13 .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: python
version: 6.2.0
version: 6.3.0
schema: 1
scm: github.com/pubnub/python
sdks:
Expand All @@ -18,7 +18,7 @@ sdks:
distributions:
- distribution-type: library
distribution-repository: package
package-name: pubnub-6.2.0
package-name: pubnub-6.3.0
location: https://pypi.org/project/pubnub/
supported-platforms:
supported-operating-systems:
Expand Down Expand Up @@ -97,8 +97,8 @@ sdks:
-
distribution-type: library
distribution-repository: git release
package-name: pubnub-6.2.0
location: https://github.com/pubnub/python/releases/download/v6.2.0/pubnub-6.2.0.tar.gz
package-name: pubnub-6.3.0
location: https://github.com/pubnub/python/releases/download/v6.3.0/pubnub-6.3.0.tar.gz
supported-platforms:
supported-operating-systems:
Linux:
Expand Down Expand Up @@ -169,6 +169,11 @@ sdks:
license-url: https://github.com/aio-libs/aiohttp/blob/master/LICENSE.txt
is-required: Required
changelog:
- date: 2022-04-01
version: v6.3.0
changes:
- type: feature
text: "Add methods to include additional fields in fetch_messages."
- date: 2022-03-21
version: v6.2.0
changes:
Expand Down
6 changes: 6 additions & 0 deletions 6 CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v6.3.0
April 01 2022

#### Added
- Add methods to include additional fields in fetch_messages.

## v6.2.0
March 21 2022

Expand Down
18 changes: 18 additions & 0 deletions 18 pubnub/endpoints/fetch_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def __init__(self, pubnub):
self._count = None
self._include_meta = None
self._include_message_actions = None
self._include_message_type = None
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have it in Kotlin SDK :/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've included all fields that were required to completely mimic the behavior of REST endpoint

self._include_uuid = None

def channels(self, channels):
utils.extend_list(self._channels, channels)
Expand Down Expand Up @@ -64,6 +66,16 @@ def include_message_actions(self, include_message_actions):
self._include_message_actions = include_message_actions
return self

def include_message_type(self, include_message_type):
assert isinstance(include_message_type, bool)
self._include_message_type = include_message_type
return self

def include_uuid(self, include_uuid):
assert isinstance(include_uuid, bool)
self._include_uuid = include_uuid
return self

def custom_params(self):
params = {'max': int(self._count)}

Expand All @@ -76,6 +88,12 @@ def custom_params(self):
if self._include_meta is not None:
params['include_meta'] = "true" if self._include_meta else "false"

if self._include_message_type is not None:
params['include_message_type'] = "true" if self._include_message_type else "false"

if self.include_message_actions and self._include_uuid is not None:
params['include_uuid'] = "true" if self._include_uuid else "false"

return params

def build_path(self):
Expand Down
5 changes: 5 additions & 0 deletions 5 pubnub/models/consumer/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ def from_json(cls, json_input, include_message_actions=False, start_timetoken=No
channels[key] = []
for item in entry:
message = PNFetchMessageItem(item['message'], item['timetoken'])
if 'uuid' in item:
message.uuid = item['uuid']
if 'message_type' in item:
message.message_type = item['message_type']

if 'meta' in item:
message.meta = item['meta']

Expand Down
2 changes: 1 addition & 1 deletion 2 pubnub/pubnub_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

class PubNubCore:
"""A base class for PubNub Python API implementations"""
SDK_VERSION = "6.2.0"
SDK_VERSION = "6.3.0"
SDK_NAME = "PubNub-Python"

TIMESTAMP_DIVIDER = 1000
Expand Down
2 changes: 1 addition & 1 deletion 2 setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='pubnub',
version='6.2.0',
version='6.3.0',
description='PubNub Real-time push service in the cloud',
author='PubNub',
author_email='support@pubnub.com',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- PubNub-Python/6.2.0
method: GET
uri: https://ps.pndsn.com/publish/pub-c-739aa0fc-3ed5-472b-af26-aca1b333ec52/sub-c-33f55052-190b-11e6-bfbc-02ee2ddab7fe/0/fetch-messages-types/0/%22hey-type%22?seqn=1
response:
body:
string: '[1,"Sent","16485850413471824"]'
headers:
Access-Control-Allow-Methods:
- GET
Access-Control-Allow-Origin:
- '*'
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Length:
- '30'
Content-Type:
- text/javascript; charset="UTF-8"
Date:
- Tue, 29 Mar 2022 20:17:21 GMT
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- PubNub-Python/6.2.0
method: GET
uri: https://ps.pndsn.com/v3/history-with-actions/sub-key/sub-c-33f55052-190b-11e6-bfbc-02ee2ddab7fe/channel/fetch-messages-types?include_message_type=true&include_meta=false&max=25
response:
body:
string: '{"status": 200, "channels": {"fetch-messages-types": [{"message": "hey-type",
"timetoken": "16485843895487893", "message_type": "1"}]}, "error_message":
"", "error": false}'
headers:
Accept-Ranges:
- bytes
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Methods:
- GET, POST, DELETE, OPTIONS
Access-Control-Allow-Origin:
- '*'
Age:
- '0'
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Length:
- '335'
Content-Type:
- text/javascript; charset="UTF-8"
Date:
- Tue, 29 Mar 2022 20:17:22 GMT
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- PubNub-Python/6.2.0
method: GET
uri: https://ps.pndsn.com/publish/pub-c-739aa0fc-3ed5-472b-af26-aca1b333ec52/sub-c-33f55052-190b-11e6-bfbc-02ee2ddab7fe/0/fetch-messages-actions-meta-1/0/%22hey-meta%22?meta=%7B%22is-this%22%3A+%22krusty-krab%22%7D&seqn=1
response:
body:
string: '[1,"Sent","16485817254069189"]'
headers:
Access-Control-Allow-Methods:
- GET
Access-Control-Allow-Origin:
- '*'
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Length:
- '30'
Content-Type:
- text/javascript; charset="UTF-8"
Date:
- Tue, 29 Mar 2022 19:22:05 GMT
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- PubNub-Python/6.2.0
method: GET
uri: https://ps.pndsn.com/publish/pub-c-739aa0fc-3ed5-472b-af26-aca1b333ec52/sub-c-33f55052-190b-11e6-bfbc-02ee2ddab7fe/0/fetch-messages-actions-meta-1/0/%22hey-meta%22?meta=%7B%22this-is%22%3A+%22patrick%22%7D&seqn=2
response:
body:
string: '[1,"Sent","16485817254397299"]'
headers:
Access-Control-Allow-Methods:
- GET
Access-Control-Allow-Origin:
- '*'
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Length:
- '30'
Content-Type:
- text/javascript; charset="UTF-8"
Date:
- Tue, 29 Mar 2022 19:22:05 GMT
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- PubNub-Python/6.2.0
method: GET
uri: https://ps.pndsn.com/v3/history-with-actions/sub-key/sub-c-33f55052-190b-11e6-bfbc-02ee2ddab7fe/channel/fetch-messages-actions-meta-1?include_meta=true&max=25
response:
body:
string: '{"status": 200, "channels": {"fetch-messages-actions-meta-1": [{"message":
"hey-meta", "timetoken": "16485817079213403", "meta": {"is-this": "krusty-krab"}},
{"message": "hey-meta", "timetoken": "16485817079522020", "meta": {"this-is":
"patrick"}}]}, "error_message": "", "error": false}'
headers:
Accept-Ranges:
- bytes
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Methods:
- GET, POST, DELETE, OPTIONS
Access-Control-Allow-Origin:
- '*'
Age:
- '0'
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Length:
- '287'
Content-Type:
- text/javascript; charset="UTF-8"
Date:
- Tue, 29 Mar 2022 19:22:05 GMT
status:
code: 200
message: OK
version: 1
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.