diff options
| author | Devendra | 2013-07-10 10:39:58 +0530 |
|---|---|---|
| committer | Devendra | 2013-07-10 10:39:58 +0530 |
| commit | e65cc45e333cc33d19b97b5f93e69121ca2beffa (patch) | |
| tree | 284435394f510ab1cd165fdac9b7bded5709dc83 /common | |
| parent | dd2e5481c7b0f96d8caae5a613db0c407711999d (diff) | |
| download | pubnub-python-e65cc45e333cc33d19b97b5f93e69121ca2beffa.tar.bz2 | |
adding makefiles for version updates
Diffstat (limited to 'common')
| -rw-r--r-- | common/Makefile | 16 | ||||
| -rw-r--r-- | common/PubnubBase.py | 20 | ||||
| -rw-r--r-- | common/PubnubCoreAsync.py | 9 |
3 files changed, 35 insertions, 10 deletions
diff --git a/common/Makefile b/common/Makefile new file mode 100644 index 0000000..1be6f8c --- /dev/null +++ b/common/Makefile @@ -0,0 +1,16 @@ +include ../Makefile.inc + + +.PHONY: all +all: build + +.PHONY: build +build: + find -name "Pubnub*py" | xargs sed -i "s/PubNub\ [0-9]\.[0-9]\.[0-9]/PubNub\ $(VERSION)/g" + + +.PHONY: clean +clean: + +.PHONY: test +test: diff --git a/common/PubnubBase.py b/common/PubnubBase.py index 0691a87..b5da9fa 100644 --- a/common/PubnubBase.py +++ b/common/PubnubBase.py @@ -319,22 +319,22 @@ class PubnubBase(object): ## Capture User Input channel = str(args['channel']) - params = [] + params = dict() count = 100 if args.has_key('count'): count = int(args['count']) - params.append('count' + '=' + str(count)) + params['count'] = str(count) if args.has_key('reverse'): - params.append('reverse' + '=' + str(args['reverse']).lower()) + params['reverse'] = str(args['reverse']).lower() if args.has_key('start'): - params.append('start' + '=' + str(args['start'])) + params['start'] = str(args['start']) if args.has_key('end'): - params.append('end' + '=' + str(args['end'])) + params['end'] = str(args['end']) ## Fail if bad input. if not channel : @@ -348,14 +348,14 @@ class PubnubBase(object): callback = None ## Get History - return self._request([ + return self._request({ 'urlcomponents' : [ 'v2', 'history', 'sub-key', self.subscribe_key, 'channel', channel, - ],params=params , callback=callback); + ],'urlparams' : params }, callback=callback); def time(self, args = None) : """ @@ -377,10 +377,10 @@ class PubnubBase(object): callback = args['callback'] else : callback = None - time = self._request([ + time = self._request({'urlcomponents' : [ 'time', '0' - ], callback) + ]}, callback) if time != None: return time[0] @@ -400,5 +400,5 @@ class PubnubBase(object): ch for ch in list(bit) ]) for bit in request["urlcomponents"]]) if (request.has_key("urlparams")): - url = url + '?' + "&".join([ x + "=" + y for x,y in request["urlparams"].items()]) + url = url + '?' + "&".join([ x + "=" + y for x,y in request["urlparams"].iteritems()]) return url diff --git a/common/PubnubCoreAsync.py b/common/PubnubCoreAsync.py index 9dcad4b..5b8d130 100644 --- a/common/PubnubCoreAsync.py +++ b/common/PubnubCoreAsync.py @@ -188,3 +188,12 @@ class PubnubCoreAsync(PubnubBase): ## BEGIN SUBSCRIPTION (LISTEN FOR MESSAGES) _subscribe() + def unsubscribe( self, args ): + channel = str(args['channel']) + if not (channel in self.subscriptions): + return False + + ## DISCONNECT + self.subscriptions[channel]['connected'] = 0 + self.subscriptions[channel]['timetoken'] = 0 + self.subscriptions[channel]['first'] = False |
