diff options
| author | Devendra | 2013-02-24 23:57:51 +0530 |
|---|---|---|
| committer | Devendra | 2013-02-24 23:57:51 +0530 |
| commit | 8b1a2eb372f2206f24029cc7e4694ae472599d95 (patch) | |
| tree | 54894f79624e3c7fe9ede1dd89ac724944fff76e /python-tornado/Pubnub.py | |
| parent | 51b1dec8b04258f7bff59fb5bb4f69cbab52260c (diff) | |
| download | pubnub-python-8b1a2eb372f2206f24029cc7e4694ae472599d95.tar.bz2 | |
saving work on async clients consolidation
Diffstat (limited to 'python-tornado/Pubnub.py')
| -rw-r--r-- | python-tornado/Pubnub.py | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/python-tornado/Pubnub.py b/python-tornado/Pubnub.py index e9251f8..a7d8a01 100644 --- a/python-tornado/Pubnub.py +++ b/python-tornado/Pubnub.py @@ -9,7 +9,6 @@ ## PubNub 3.1 Real-time Push Cloud API ## ----------------------------------- import sys -sys.path.append('../') from PubnubCoreAsync import PubnubCoreAsync import json import time @@ -55,24 +54,15 @@ class Pubnub(PubnubCoreAsync): ssl_on, origin, ) + self.headers['User-Agent'] = 'Python-Tornado' def _request( self, request, callback ) : - ## Build URL - url = self.origin + '/' + "/".join([ - "".join([ ' ~`!@#$%^&*()+=[]\\{}|;\':",./<>?'.find(ch) > -1 and - hex(ord(ch)).replace( '0x', '%' ).upper() or - ch for ch in list(bit) - ]) for bit in request]) + url = self.getUrl(request) print url ## Send Request Expecting JSON Response http = tornado.httpclient.AsyncHTTPClient(max_clients=1000) - request = tornado.httpclient.HTTPRequest( url, 'GET', dict({ - 'V' : '3.1', - 'User-Agent' : 'Python-Tornado', - 'Accept-Encoding' : 'gzip' - }) ) + request = tornado.httpclient.HTTPRequest( url, 'GET', self.headers ) def responseCallback(response): - print response._get_body() callback(response._get_body()) http.fetch( |
