diff options
| author | Devendra | 2013-02-25 15:19:20 +0530 |
|---|---|---|
| committer | Devendra | 2013-02-25 15:19:20 +0530 |
| commit | 2ea3826d516fdf10a889e98ffab04a8f1d790650 (patch) | |
| tree | c3ce186125e287a85d30f28f9f20f16a632da59a /python-tornado | |
| parent | 8b1a2eb372f2206f24029cc7e4694ae472599d95 (diff) | |
| download | pubnub-python-2ea3826d516fdf10a889e98ffab04a8f1d790650.tar.bz2 | |
saving python async consolidation work
Diffstat (limited to 'python-tornado')
| -rw-r--r-- | python-tornado/Pubnub.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/python-tornado/Pubnub.py b/python-tornado/Pubnub.py index a7d8a01..880e396 100644 --- a/python-tornado/Pubnub.py +++ b/python-tornado/Pubnub.py @@ -48,27 +48,29 @@ class Pubnub(PubnubCoreAsync): origin = 'pubsub.pubnub.com' ) : super(Pubnub, self).__init__( - publish_key, - subscribe_key, - secret_key, - ssl_on, - origin, + publish_key=publish_key, + subscribe_key=subscribe_key, + secret_key=secret_key, + ssl_on=ssl_on, + origin=origin, ) + self.headers = {} self.headers['User-Agent'] = 'Python-Tornado' + self.headers['Accept-Encoding'] = self.accept_encoding + self.headers['V'] = self.version + self.http = tornado.httpclient.AsyncHTTPClient(max_clients=1000) def _request( self, request, callback ) : url = self.getUrl(request) print url ## Send Request Expecting JSON Response - http = tornado.httpclient.AsyncHTTPClient(max_clients=1000) - request = tornado.httpclient.HTTPRequest( url, 'GET', self.headers ) + #print self.headers + request = tornado.httpclient.HTTPRequest( url, 'GET', self.headers, connect_timeout=310, request_timeout=310 ) def responseCallback(response): callback(response._get_body()) - http.fetch( + self.http.fetch( request, callback=responseCallback, - connect_timeout=310, - request_timeout=310 ) |
