File tree Expand file tree Collapse file tree 8 files changed +127
-6
lines changed
fixtures/native_sync/publish Expand file tree Collapse file tree 8 files changed +127
-6
lines changed Original file line number Diff line number Diff line change 1
1
name : python
2
- version : 7.0.2
2
+ version : 7.1.0
3
3
schema : 1
4
4
scm : github.com/pubnub/python
5
5
sdks :
18
18
distributions :
19
19
- distribution-type : library
20
20
distribution-repository : package
21
- package-name : pubnub-7.0.2
21
+ package-name : pubnub-7.1.0
22
22
location : https://pypi.org/project/pubnub/
23
23
supported-platforms :
24
24
supported-operating-systems :
97
97
-
98
98
distribution-type : library
99
99
distribution-repository : git release
100
- package-name : pubnub-7.0.2
101
- location : https://github.com/pubnub/python/releases/download/7.0.2 /pubnub-7.0.2 .tar.gz
100
+ package-name : pubnub-7.1.0
101
+ location : https://github.com/pubnub/python/releases/download/7.1.0 /pubnub-7.1.0 .tar.gz
102
102
supported-platforms :
103
103
supported-operating-systems :
104
104
Linux :
@@ -169,6 +169,11 @@ sdks:
169
169
license-url : https://github.com/aio-libs/aiohttp/blob/master/LICENSE.txt
170
170
is-required : Required
171
171
changelog :
172
+ - date : 2023-01-17
173
+ version : 7.1.0
174
+ changes :
175
+ - type : feature
176
+ text : " Add optional TTL parameter for publish endpoint."
172
177
- date : 2022-11-24
173
178
version : 7.0.2
174
179
changes :
Original file line number Diff line number Diff line change
1
+ ## 7.1.0
2
+ January 17 2023
3
+
4
+ #### Added
5
+ - Add optional TTL parameter for publish endpoint.
6
+
1
7
## 7.0.2
2
8
November 24 2022
3
9
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ def __init__(self, pubnub):
21
21
self ._meta = None
22
22
self ._replicate = None
23
23
self ._ptto = None
24
+ self ._ttl = None
24
25
25
26
def channel (self , channel ):
26
27
self ._channel = str (channel )
@@ -49,6 +50,10 @@ def meta(self, meta):
49
50
self ._meta = meta
50
51
return self
51
52
53
+ def ttl (self , ttl ):
54
+ self ._ttl = ttl
55
+ return self
56
+
52
57
def build_data (self ):
53
58
if self ._use_post is True :
54
59
cipher = self .pubnub .config .cipher_key
@@ -70,6 +75,9 @@ def encoded_params(self):
70
75
def custom_params (self ):
71
76
params = TimeTokenOverrideMixin .custom_params (self )
72
77
78
+ if self ._ttl :
79
+ params ['ttl' ] = self ._ttl
80
+
73
81
if self ._meta :
74
82
params ['meta' ] = utils .write_value_as_string (self ._meta )
75
83
Original file line number Diff line number Diff line change 83
83
84
84
class PubNubCore :
85
85
"""A base class for PubNub Python API implementations"""
86
- SDK_VERSION = "7.0.2 "
86
+ SDK_VERSION = "7.1.0 "
87
87
SDK_NAME = "PubNub-Python"
88
88
89
89
TIMESTAMP_DIVIDER = 1000
Original file line number Diff line number Diff line change 2
2
3
3
setup (
4
4
name = 'pubnub' ,
5
- version = '7.0.2 ' ,
5
+ version = '7.1.0 ' ,
6
6
description = 'PubNub Real-time push service in the cloud' ,
7
7
author = 'PubNub' ,
8
8
Original file line number Diff line number Diff line change
1
+ interactions :
2
+ - request :
3
+ body : null
4
+ headers :
5
+ Accept :
6
+ - ' */*'
7
+ Accept-Encoding :
8
+ - gzip, deflate
9
+ Connection :
10
+ - keep-alive
11
+ User-Agent :
12
+ - PubNub-Python/7.0.2
13
+ method : GET
14
+ uri : https://ps.pndsn.com/publish/pub-c-739aa0fc-3ed5-472b-af26-aca1b333ec52/sub-c-33f55052-190b-11e6-bfbc-02ee2ddab7fe/0/ch1/0/%22hi%22?seqn=1
15
+ response :
16
+ body :
17
+ string : ' [1,"Sent","16738723726258763"]'
18
+ headers :
19
+ Access-Control-Allow-Methods :
20
+ - GET
21
+ Access-Control-Allow-Origin :
22
+ - ' *'
23
+ Cache-Control :
24
+ - no-cache
25
+ Connection :
26
+ - keep-alive
27
+ Content-Length :
28
+ - ' 30'
29
+ Content-Type :
30
+ - text/javascript; charset="UTF-8"
31
+ Date :
32
+ - Mon, 16 Jan 2023 12:32:52 GMT
33
+ status :
34
+ code : 200
35
+ message : OK
36
+ version : 1
Original file line number Diff line number Diff line change
1
+ interactions :
2
+ - request :
3
+ body : null
4
+ headers :
5
+ Accept :
6
+ - ' */*'
7
+ Accept-Encoding :
8
+ - gzip, deflate
9
+ Connection :
10
+ - keep-alive
11
+ User-Agent :
12
+ - PubNub-Python/7.0.2
13
+ method : GET
14
+ uri : https://ps.pndsn.com/publish/pub-c-739aa0fc-3ed5-472b-af26-aca1b333ec52/sub-c-33f55052-190b-11e6-bfbc-02ee2ddab7fe/0/ch1/0/%22hi%22?seqn=1&ttl=100
15
+ response :
16
+ body :
17
+ string : ' [1,"Sent","16738723727729716"]'
18
+ headers :
19
+ Access-Control-Allow-Methods :
20
+ - GET
21
+ Access-Control-Allow-Origin :
22
+ - ' *'
23
+ Cache-Control :
24
+ - no-cache
25
+ Connection :
26
+ - keep-alive
27
+ Content-Length :
28
+ - ' 30'
29
+ Content-Type :
30
+ - text/javascript; charset="UTF-8"
31
+ Date :
32
+ - Mon, 16 Jan 2023 12:32:52 GMT
33
+ status :
34
+ code : 200
35
+ message : OK
36
+ version : 1
Original file line number Diff line number Diff line change @@ -341,3 +341,33 @@ def test_single_quote_character_message_encoded_ok(self):
341
341
.sync ()
342
342
343
343
assert envelope
344
+
345
+ @pn_vcr .use_cassette ('tests/integrational/fixtures/native_sync/publish/publish_ttl_0.yaml' ,
346
+ filter_query_parameters = ['uuid' , 'pnsdk' ])
347
+ def test_publish_ttl_0 (self ):
348
+ try :
349
+ env = PubNub (pnconf ).publish () \
350
+ .channel ("ch1" ) \
351
+ .message ("hi" ) \
352
+ .ttl (0 ) \
353
+ .sync ()
354
+
355
+ assert isinstance (env .result , PNPublishResult )
356
+ assert env .result .timetoken > 1
357
+ except PubNubException as e :
358
+ self .fail (e )
359
+
360
+ @pn_vcr .use_cassette ('tests/integrational/fixtures/native_sync/publish/publish_ttl_100.yaml' ,
361
+ filter_query_parameters = ['uuid' , 'pnsdk' ])
362
+ def test_publish_ttl_100 (self ):
363
+ try :
364
+ env = PubNub (pnconf ).publish () \
365
+ .channel ("ch1" ) \
366
+ .message ("hi" ) \
367
+ .ttl (100 ) \
368
+ .sync ()
369
+
370
+ assert isinstance (env .result , PNPublishResult )
371
+ assert env .result .timetoken > 1
372
+ except PubNubException as e :
373
+ self .fail (e )
You can’t perform that action at this time.
0 commit comments