diff options
| author | Devendra | 2014-05-08 04:12:28 +0530 |
|---|---|---|
| committer | Devendra | 2014-05-08 04:12:28 +0530 |
| commit | 1607828ef5d2ef6c3ce357f83f53ea109be02182 (patch) | |
| tree | 5abde41566f2a2fc4eccdfdb07a3eee9e970de0d | |
| parent | 09dbc7589b35963be1835ed58dcfd09d4d5c3ccc (diff) | |
| download | pubnub-python-1607828ef5d2ef6c3ce357f83f53ea109be02182.tar.bz2 | |
updating package urls
| -rw-r--r-- | Pubnub.py | 23 | ||||
| -rw-r--r-- | dist/pubnub-3.5.0-beta.tar.gz | bin | 9447 -> 9451 bytes | |||
| -rw-r--r-- | python/examples/pubnub-console/dist/pubnub-console-3.5.0-beta.tar.gz | bin | 4627 -> 4647 bytes | |||
| -rw-r--r-- | python/examples/pubnub-console/setup.py | 2 | ||||
| -rw-r--r-- | setup.py | 2 |
5 files changed, 15 insertions, 12 deletions
@@ -115,6 +115,13 @@ except ImportError: ####################################### +def get_data_for_user(data): + if 'message' in data and 'payload' in data: + return {'message': data['message'], 'payload': data['payload']} + else: + return data + + class PubnubCrypto2(): """ #** @@ -757,9 +764,9 @@ class PubnubCoreAsync(PubnubBase): def _invoke(func, msg=None, channel=None): if func is not None: if msg is not None and channel is not None: - func(msg, channel) + func(get_data_for_user(msg), channel) elif msg is not None: - func(msg) + func(get_data_for_user(msg)) else: func() @@ -1065,7 +1072,7 @@ class HTTPClient: def _invoke(func, data): if func is not None: - func(data) + func(get_data_for_user(data)) if self._urllib_func is None: return @@ -1132,15 +1139,11 @@ def _requests_request(url, timeout=320): try: resp = s.get(url, timeout=timeout) except requests.exceptions.HTTPError as http_error: - print http_error resp = http_error except requests.exceptions.ConnectionError as error: - print error msg = str(error) return (json.dumps(msg), 0) except requests.exceptions.Timeout as error: - print(error) - #print('timeout'); msg = str(error) return (json.dumps(msg), 0) return (resp.text, resp.status_code) @@ -1242,7 +1245,7 @@ class PubnubAsync(PubnubCoreAsync): def _request(self, request, callback=None, error=None, single=False): if callback is None: - return self._request_sync(request) + return get_data_for_user(self._request_sync(request)) else: self._request_async(request, callback, error, single=single) @@ -1313,7 +1316,7 @@ class PubnubTwisted(PubnubCoreAsync): def _invoke(func, data): if func is not None: - func(data) + func(get_data_for_user(data)) ## Build URL @@ -1418,7 +1421,7 @@ class PubnubTornado(PubnubCoreAsync): def _invoke(func, data): if func is not None: - func(data) + func(get_data_for_user(data)) url = self.getUrl(request) request = tornado.httpclient.HTTPRequest( diff --git a/dist/pubnub-3.5.0-beta.tar.gz b/dist/pubnub-3.5.0-beta.tar.gz Binary files differindex 6201683..3ed2de3 100644 --- a/dist/pubnub-3.5.0-beta.tar.gz +++ b/dist/pubnub-3.5.0-beta.tar.gz diff --git a/python/examples/pubnub-console/dist/pubnub-console-3.5.0-beta.tar.gz b/python/examples/pubnub-console/dist/pubnub-console-3.5.0-beta.tar.gz Binary files differindex 39540f6..278e9fa 100644 --- a/python/examples/pubnub-console/dist/pubnub-console-3.5.0-beta.tar.gz +++ b/python/examples/pubnub-console/dist/pubnub-console-3.5.0-beta.tar.gz diff --git a/python/examples/pubnub-console/setup.py b/python/examples/pubnub-console/setup.py index 1ef09be..d46314e 100644 --- a/python/examples/pubnub-console/setup.py +++ b/python/examples/pubnub-console/setup.py @@ -6,7 +6,7 @@ setup( description='PubNub Developer Console', author='Stephen Blum', author_email='support@pubnub.com', - url='http://pubnub.s3.amazonaws.com/pip/pubnub-3.3.5.tar.gz', + url='https://github.com/pubnub/python/raw/async/python/examples/pubnub-console/dist/pubnub-console-3.5.0-beta.tar.gz', scripts=['pubnub-console'], license='MIT', classifiers=( @@ -6,7 +6,7 @@ setup( description='PubNub Real-time push service in the cloud', author='Stephen Blum', author_email='support@pubnub.com', - url='http://pubnub.s3.amazonaws.com/pip/pubnub-3.3.5.tar.gz', + url='https://github.com/pubnub/python/raw/async/dist/pubnub-3.5.0-beta.tar.gz', py_modules=['Pubnub'], license='MIT', classifiers=( |
