tornado

Tornado curl_httpclient 'reset' connection

人盡茶涼 提交于 2019-12-13 03:56:10
问题 I have a tornado application that makes requests to an http server using curl_httpclient. Every once in a while, all calls to the server returns incorrect results. In other words, the http responses are still fine, but the contents returned by the server becomes incorrect. I find I can get around this problem by terminating and restarting my process, which seems to mean that if I make a new TCP connection to the server and send new requests, things will be fine. Now my problem is how to make

Tornado long polling requests

江枫思渺然 提交于 2019-12-13 02:42:57
问题 Below is the most simple example of my issue: When a request is made it will print Request via GET <__main__.MainHandler object at 0x104041e10> and then the request will remain open. Good! However, when you make another request it does not call the MainHandler.get method until the first connection has finished. How can I get multiple requests into the get method while having them remain long-polling. I'm passing arguments with each request that will get different results from a pub/sub via

Import Error - Tornado requires an updated SSL module on ubuntu 14.04

99封情书 提交于 2019-12-13 02:17:57
问题 while installing juypter notebook on my ubuntu 14.04 I am getting this: ImportError: Tornado requires an up-to-date SSL module. This means Python 2.7.9+ or 3.4+ (although some distributions have backported the necessary changes to older versions). Pip is: pip 10.0.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7) how to resolve this ? 回答1: Latest tornado library doesn't support your interpreter version. You have two options. Either install old tornado (recommended): pip install

Get the value of the dynamic anchor tag and pass it to the next page

旧时模样 提交于 2019-12-13 01:28:48
问题 I am developing a web application using Tornado framework. Currently I am working on a front end view. This page actually displays a list of ids and a small note about that id. (Its a table with two columns) id -------- Note 100 ----- Note on 100 101 ----- Note on 101 ![Table with link on id and note on id][1] The ids are displayed dynamically. When I click on the id (its a link- anchor tag), it should take me to another page which has all the details about that id. Approach - I thought of

How to get the client port in RequestHandler?

☆樱花仙子☆ 提交于 2019-12-13 00:48:51
问题 In the RequestHandler we can use self.request.remote_ip to get the client ip address, but how to get the client port? And, if the client side implemented with tornado.simple_httpclient.SimpleAsyncHTTPClient , how to get the port for this connection? 回答1: Why do you want the client port? There's not currently a supported interface for this although I think self.request.connection.stream.socket.getpeername() will work (untested). I don't understand your second question about "request port" in

“WARNING:tornado.access:405” error stopping POST from both “localhost” and “file://” origins

[亡魂溺海] 提交于 2019-12-13 00:48:17
问题 This is a very similar problem to this question (Tornado POST 405: Method Not Allowed), but the dead simple answer for that question is still not working. There are also many, many more similar questions in the side bar -----> which are not related to Tornado, and did not provide me with a solution. Right now I am using Firefox on OSX. My tornado code is as follows: import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): def post(self): self.write("Hello, world

Set timeout to an http request in Tornado

天涯浪子 提交于 2019-12-12 21:13:04
问题 I have this part of code: como_url = "".join(['http://', options.como_address, ':', options.como_port, '/ztc_config?netid=0&opcode_group=0&opcode=0&start=-20s&end=-1s']) http_client = AsyncHTTPClient() response = yield tornado.gen.Task(http_client.fetch, como_url) where I do an http request. I would add a connection timeout, to be sure that the previous code is been executed, so I can find my response. How can I add the timeout? I have to add it into the tornado.gen.Task call? I don't know

how to get favicon.ico work on tornado

ぐ巨炮叔叔 提交于 2019-12-12 13:40:43
问题 the tornado server didn't do the favicon.ico by default,so i always get the info like these [W 130626 10:38:16 web:1514] 404 GET /favicon.ico (192.168.1.57) 0.57ms i use the web.staticfilehandler in various way include the source's example,and couldn't get it work, i got things work like this below. handlers = [ (r'/favicon.ico', tornado.web.StaticFileHandler,dict(url='/static/favicon.ico',permanent=False)), (r'/static/(.*)', tornado.web.StaticFileHandler, {"path": "plserver"}), ] i felt so

Tornado Web and Threads

三世轮回 提交于 2019-12-12 12:25:49
问题 I am new to Tornado and Python Threads. What I would like to achieve is the following: I have a Tornado web server which takes requests from users. I want to store some of the data locally and write it periodically to a data base as bulk-inserts. import tornado.ioloop import tornado.web import threading # Keep userData locally in memory UserData = {} def background(f): """ a threading decorator use @background above the function you want to thread (run in the background) """ def bg_f(*a, **kw

ssl sockets not supported error

假装没事ソ 提交于 2019-12-12 10:39:46
问题 I'm running tornado webserver for secure websocket connection on linux centos 6.6. I'm using Qt/c++ client to connect using a QWebsocket by opening a url like "wss://191.23.4.56/etr/job". I'm getting error like, " SSL sockets are not supported in this platform " What is this error about? 回答1: The error message "SSL sockets are not supported in this platform" is printed by QWebSocket::open() when the URL scheme is wss and QSslSocket::supportsSsl() returns false . The static member function