Skip to content

Commit b541bd7

Browse files
Sebastian Molendapubnub-release-bot
andauthored
Remove requirement to pass channels in pubnub.add_channels_to_push (#221)
* Remove requirement to pass channels in pubnub.add_channels_to_push * Fix typo in remove_channels_from_push.sync() * Tests part 1. * Tests pt. 2 * Tests pt.3 * Tests pt.4 Final * Tests pt.4 Final-2 * PubNub SDK 10.4.1 release. --------- Co-authored-by: PubNub Release Bot <[email protected]>
1 parent 9e8b90e commit b541bd7

File tree

99 files changed

+11785
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+11785
-8
lines changed

.pubnub.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: python
2-
version: 10.4.0
2+
version: 10.4.1
33
schema: 1
44
scm: github.com/pubnub/python
55
sdks:
@@ -18,7 +18,7 @@ sdks:
1818
distributions:
1919
- distribution-type: library
2020
distribution-repository: package
21-
package-name: pubnub-10.4.0
21+
package-name: pubnub-10.4.1
2222
location: https://pypi.org/project/pubnub/
2323
supported-platforms:
2424
supported-operating-systems:
@@ -94,8 +94,8 @@ sdks:
9494
-
9595
distribution-type: library
9696
distribution-repository: git release
97-
package-name: pubnub-10.4.0
98-
location: https://github.com/pubnub/python/releases/download/10.4.0/pubnub-10.4.0.tar.gz
97+
package-name: pubnub-10.4.1
98+
location: https://github.com/pubnub/python/releases/download/10.4.1/pubnub-10.4.1.tar.gz
9999
supported-platforms:
100100
supported-operating-systems:
101101
Linux:
@@ -169,6 +169,11 @@ sdks:
169169
license-url: https://github.com/encode/httpx/blob/master/LICENSE.md
170170
is-required: Required
171171
changelog:
172+
- date: 2025-06-05
173+
version: 10.4.1
174+
changes:
175+
- type: bug
176+
text: "Fixed add_channel_to_push and remove_channel_from_push endpoints."
172177
- date: 2025-05-07
173178
version: 10.4.0
174179
changes:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 10.4.1
2+
June 05 2025
3+
4+
#### Fixed
5+
- Fixed add_channel_to_push and remove_channel_from_push endpoints.
6+
17
## 10.4.0
28
May 07 2025
39

pubnub/endpoints/push/remove_channels_from_push.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def create_response(self, envelope) -> PNPushRemoveChannelResult:
9898
return PNPushRemoveChannelResult()
9999

100100
def sync(self) -> PNPushRemoveChannelResultEnvelope:
101-
return PNPushRemoveChannelResultEnvelope(self.process_sync())
101+
return PNPushRemoveChannelResultEnvelope(super().sync())
102102

103103
def is_auth_required(self):
104104
return True

pubnub/pubnub_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ def list_push_channels(self, device_id: str = None, push_type: PNPushType = None
629629
"""
630630
return ListPushProvisions(self, device_id=device_id, push_type=push_type, topic=topic, environment=environment)
631631

632-
def add_channels_to_push(self, channels: Union[str, List[str]], device_id: str = None,
632+
def add_channels_to_push(self, channels: Union[str, List[str]] = None, device_id: str = None,
633633
push_type: PNPushType = None, topic: str = None,
634634
environment: PNPushEnvironment = None) -> AddChannelsToPush:
635635
"""Register channels for push notifications.

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

tests/functional/push/test_add_channels_to_push.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
import pubnub.enums
1111

1212
from pubnub.endpoints.push.add_channels_to_push import AddChannelsToPush
13-
from tests.helper import pnconf, sdk_name
13+
from tests.helper import pnconf, pnconf_env_copy, sdk_name
1414
from pubnub.managers import TelemetryManager
15+
from pubnub.enums import PNPushType, PNPushEnvironment
1516

1617

1718
class TestAddChannelsFromPush(unittest.TestCase):
@@ -89,3 +90,15 @@ def test_push_add_single_channel_apns2(self):
8990
})
9091

9192
self.assertEqual(self.add_channels._channels, ['ch'])
93+
94+
def test_add_channels_to_push_builder(self):
95+
config = pnconf_env_copy()
96+
pubnub = PubNub(config)
97+
endpoint = pubnub.add_channels_to_push() \
98+
.channels(['ch1', 'ch2']) \
99+
.device_id("00000000000000000000000000000000") \
100+
.push_type(PNPushType.APNS2) \
101+
.environment(PNPushEnvironment.PRODUCTION) \
102+
.topic("testTopic")
103+
result = endpoint.sync()
104+
self.assertEqual(result.status.error, None)
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"version": 1,
3+
"interactions": [
4+
{
5+
"request": {
6+
"method": "GET",
7+
"uri": "https://ps.pndsn.com/v2/push/sub-key/{PN_KEY_SUBSCRIBE}/devices-apns2/0000000000000000?add=apns2_channel_1%2Capns2_channel_2&environment=development&topic=com.example.testapp.notifications&uuid=test-uuid",
8+
"body": "",
9+
"headers": {
10+
"host": [
11+
"ps.pndsn.com"
12+
],
13+
"accept": [
14+
"*/*"
15+
],
16+
"accept-encoding": [
17+
"gzip, deflate"
18+
],
19+
"connection": [
20+
"keep-alive"
21+
],
22+
"user-agent": [
23+
"PubNub-Python/10.4.0"
24+
]
25+
}
26+
},
27+
"response": {
28+
"status": {
29+
"code": 200,
30+
"message": "OK"
31+
},
32+
"headers": {
33+
"Date": [
34+
"Thu, 05 Jun 2025 11:59:00 GMT"
35+
],
36+
"Content-Type": [
37+
"text/javascript; charset=\"UTF-8\""
38+
],
39+
"Content-Length": [
40+
"24"
41+
],
42+
"Connection": [
43+
"keep-alive"
44+
],
45+
"Cache-Control": [
46+
"no-cache"
47+
],
48+
"Access-Control-Allow-Methods": [
49+
"GET, POST, DELETE, OPTIONS"
50+
],
51+
"Access-Control-Allow-Credentials": [
52+
"true"
53+
],
54+
"Access-Control-Expose-Headers": [
55+
"*"
56+
]
57+
},
58+
"body": {
59+
"pickle": "gASVKAAAAAAAAAB9lIwGc3RyaW5nlIwYWzEsICJNb2RpZmllZCBDaGFubmVscyJdlHMu"
60+
}
61+
}
62+
}
63+
]
64+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"version": 1,
3+
"interactions": [
4+
{
5+
"request": {
6+
"method": "GET",
7+
"uri": "https://ps.pndsn.com/v2/push/sub-key/{PN_KEY_SUBSCRIBE}/devices-apns2/0000000000000000?add=apns2_dev_channel_1%2Capns2_dev_channel_2&environment=development&topic=com.example.testapp.notifications&uuid=test-uuid",
8+
"body": "",
9+
"headers": {
10+
"host": [
11+
"ps.pndsn.com"
12+
],
13+
"accept": [
14+
"*/*"
15+
],
16+
"accept-encoding": [
17+
"gzip, deflate"
18+
],
19+
"connection": [
20+
"keep-alive"
21+
],
22+
"user-agent": [
23+
"PubNub-Python/10.4.0"
24+
]
25+
}
26+
},
27+
"response": {
28+
"status": {
29+
"code": 200,
30+
"message": "OK"
31+
},
32+
"headers": {
33+
"Date": [
34+
"Thu, 05 Jun 2025 11:59:01 GMT"
35+
],
36+
"Content-Type": [
37+
"text/javascript; charset=\"UTF-8\""
38+
],
39+
"Content-Length": [
40+
"24"
41+
],
42+
"Connection": [
43+
"keep-alive"
44+
],
45+
"Cache-Control": [
46+
"no-cache"
47+
],
48+
"Access-Control-Allow-Methods": [
49+
"GET, POST, DELETE, OPTIONS"
50+
],
51+
"Access-Control-Allow-Credentials": [
52+
"true"
53+
],
54+
"Access-Control-Expose-Headers": [
55+
"*"
56+
]
57+
},
58+
"body": {
59+
"pickle": "gASVKAAAAAAAAAB9lIwGc3RyaW5nlIwYWzEsICJNb2RpZmllZCBDaGFubmVscyJdlHMu"
60+
}
61+
}
62+
}
63+
]
64+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"version": 1,
3+
"interactions": [
4+
{
5+
"request": {
6+
"method": "GET",
7+
"uri": "https://ps.pndsn.com/v2/push/sub-key/{PN_KEY_SUBSCRIBE}/devices-apns2/0000000000000000?add=apns2_prod_channel_1%2Capns2_prod_channel_2&environment=production&topic=com.example.testapp.notifications&uuid=test-uuid",
8+
"body": "",
9+
"headers": {
10+
"host": [
11+
"ps.pndsn.com"
12+
],
13+
"accept": [
14+
"*/*"
15+
],
16+
"accept-encoding": [
17+
"gzip, deflate"
18+
],
19+
"connection": [
20+
"keep-alive"
21+
],
22+
"user-agent": [
23+
"PubNub-Python/10.4.0"
24+
]
25+
}
26+
},
27+
"response": {
28+
"status": {
29+
"code": 200,
30+
"message": "OK"
31+
},
32+
"headers": {
33+
"Date": [
34+
"Thu, 05 Jun 2025 11:59:02 GMT"
35+
],
36+
"Content-Type": [
37+
"text/javascript; charset=\"UTF-8\""
38+
],
39+
"Content-Length": [
40+
"24"
41+
],
42+
"Connection": [
43+
"keep-alive"
44+
],
45+
"Cache-Control": [
46+
"no-cache"
47+
],
48+
"Access-Control-Allow-Methods": [
49+
"GET, POST, DELETE, OPTIONS"
50+
],
51+
"Access-Control-Allow-Credentials": [
52+
"true"
53+
],
54+
"Access-Control-Expose-Headers": [
55+
"*"
56+
]
57+
},
58+
"body": {
59+
"pickle": "gASVKAAAAAAAAAB9lIwGc3RyaW5nlIwYWzEsICJNb2RpZmllZCBDaGFubmVscyJdlHMu"
60+
}
61+
}
62+
}
63+
]
64+
}

0 commit comments

Comments
 (0)