Skip to content

Commit

Permalink
PubNub SDK v4.8.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
client-engineering-bot committed Dec 9, 2020
1 parent 970c28d commit 14557a4
Show file tree
Hide file tree
Showing 147 changed files with 5,637 additions and 3,009 deletions.
8 changes: 7 additions & 1 deletion .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: python
version: 4.7.0
version: 4.8.0
schema: 1
scm: github.com/pubnub/python
changelog:
- version: v4.8.0
date: Dec 9, 2020
changes:
-
text: "Objects v2 implementation added to the PythonSDK with additional improvements to the test isolation within whole test suite."
type: feature
- version: v4.7.0
date: Nov 19, 2020
changes:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [v4.8.0](https://github.com/pubnub/python/releases/tag/v4.8.0)

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

- 🌟️ Objects v2 implementation added to the PythonSDK with additional improvements to the test isolation within whole test suite.

## [v4.7.0](https://github.com/pubnub/python/releases/tag/v4.7.0)

[Full Changelog](https://github.com/pubnub/python/compare/v4.6.1...v4.7.0)
Expand Down
4 changes: 2 additions & 2 deletions pubnub/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def presence(self, pubnub, presence):
def signal(self, pubnub, signal):
pass

def user(self, pubnub, user):
def channel(self, pubnub, channel):
pass

def space(self, pubnub, space):
def uuid(self, pubnub, uuid):
pass

def membership(self, pubnub, membership):
Expand Down
45 changes: 43 additions & 2 deletions pubnub/endpoints/access/grant.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pubnub import utils
from pubnub.endpoints.endpoint import Endpoint
from pubnub.errors import PNERR_PAM_NO_FLAGS
from pubnub.errors import PNERR_PAM_NO_FLAGS, PNERR_PAM_INVALID_ARGUMENTS
from pubnub.exceptions import PubNubException
from pubnub.enums import HttpMethod, PNOperationType
from pubnub.models.consumer.access_manager import PNAccessManagerGrantResult
Expand All @@ -14,14 +14,34 @@ def __init__(self, pubnub):
self._auth_keys = []
self._channels = []
self._groups = []
self._uuids = []
self._read = None
self._write = None
self._manage = None
self._delete = None
self._ttl = None
self._get = None
self._update = None
self._join = None

self._sort_params = True

def get(self, flag):
self._get = flag
return self

def update(self, flag):
self._update = flag
return self

def join(self, flag):
self._join = flag
return self

def uuids(self, uuids):
utils.extend_list(self._uuids, uuids)
return self

def auth_keys(self, auth_keys):
utils.extend_list(self._auth_keys, auth_keys)
return self
Expand Down Expand Up @@ -79,6 +99,12 @@ def custom_params(self):
params['m'] = '1' if self._manage is True else '0'
if self._delete is not None:
params['d'] = '1' if self._delete is True else '0'
if self._get is not None:
params['g'] = '1' if self._get is True else '0'
if self._update is not None:
params['u'] = '1' if self._update is True else '0'
if self._join is not None:
params['j'] = '1' if self._join is True else '0'

if self._auth_keys:
params['auth'] = utils.join_items(self._auth_keys)
Expand All @@ -89,6 +115,9 @@ def custom_params(self):
if self._groups:
params['channel-group'] = utils.join_items(self._groups)

if self._uuids:
params['target-uuid'] = utils.join_items(self._uuids)

if self._ttl is not None:
params['ttl'] = str(int(self._ttl))

Expand All @@ -103,9 +132,21 @@ def http_method(self):
def validate_params(self):
self.validate_subscribe_key()
self.validate_secret_key()
self.validate_publish_key()
# self.validate_channels_and_groups()

if self._write is None and self._read is None and self._manage is None:
if self._channels and self._groups and self._uuids:
raise PubNubException(
pn_error=PNERR_PAM_INVALID_ARGUMENTS,
errormsg="Grants for channels or channelGroups can't be changed together with grants for UUIDs")

if self._uuids and not self._auth_keys:
raise PubNubException(pn_error=PNERR_PAM_INVALID_ARGUMENTS, errormsg="UUIDs grant management require "
"providing non empty authKeys"
)

if self._write is None and self._read is None and self._manage is None and self._get is None \
and self._update is None and self._join is None:
raise PubNubException(pn_error=PNERR_PAM_NO_FLAGS)

def create_response(self, envelope):
Expand Down
3 changes: 3 additions & 0 deletions pubnub/endpoints/access/revoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ def __init__(self, pubnub):
self._read = False
self._write = False
self._manage = False
self._get = False
self._update = False
self._join = False

self._sort_params = True

Expand Down
17 changes: 8 additions & 9 deletions pubnub/endpoints/file_operations/publish_file_message.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from collections import OrderedDict
from pubnub.endpoints.file_operations.file_based_endpoint import FileOperationEndpoint
from pubnub.enums import HttpMethod, PNOperationType
from pubnub import utils
Expand Down Expand Up @@ -59,15 +60,13 @@ def _encrypt_message(self, message):
return message

def _build_message(self):
return self._encrypt_message(
{
"message": self._message,
"file": {
"id": self._file_id,
"name": self._file_name
}
}
)
message = OrderedDict() # TODO: remove OrderedDict while removing EOL versions of Python (v5 release, SDK-181)
message["message"] = self._message
message["file"] = OrderedDict()
message["file"]["id"] = self._file_id
message["file"]["name"] = self._file_name

return self._encrypt_message(message)

def build_path(self):
message = self._build_message()
Expand Down
2 changes: 1 addition & 1 deletion pubnub/endpoints/file_operations/send_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def encrypt_payload(self):

def build_file_upload_request(self):
file = self.encrypt_payload()
multipart_body = OrderedDict()
multipart_body = OrderedDict() # TODO: remove OrderedDict while removing EOL versions of Python (v5 release)
for form_field in self._file_upload_envelope.result.data["form_fields"]:
multipart_body[form_field["key"]] = (None, form_field["value"])

Expand Down
116 changes: 0 additions & 116 deletions pubnub/endpoints/membership/get_members.py

This file was deleted.

Loading

0 comments on commit 14557a4

Please sign in to comment.