Questions tagged [twisted.web]

Twisted Web provides a simple, stable HTTP server built on top of Twisted framework. It is suitable for all types of web apps and web services. It provides a flexible resource publishing API, and implements HTTP 1.0 with some 1.1 features. It can also be used for hosting WSGI applications.

199 questions
2
votes
1 answer

Twisted Error: Request.write called on a request after Request.finish was called

I'm trying to put slow computations inside threads, and getting an error "Request.write called on a request after Request.finish was called." I've looked through answers already, and find exact the same question, but the solution not working for me.…
2
votes
1 answer

equivalent of nevow.tags.raw for twisted.web.template

I'm trying to port pydoctor to twisted.web.template and have hit a pretty basic problem: pydoctor uses epydoc to render docstrings into HTML but I can't see a way to include this HTML in the generated page without escaping. What can I do?
mwhudson
  • 131
  • 1
  • 8
2
votes
1 answer

looping call in python twisted is not working

I am using python twisted for my real time project. Explanation: I am pulling the html pages for the url to which i give request to my remote machine.So,I am maintaining scheduler in my database machine which sends request to the remote machines…
Nava
  • 6,276
  • 6
  • 44
  • 68
2
votes
1 answer

Can't test reactor.callInThread in my twisted web resource

I have a twisted Web Resource wich handles incoming requests and sends celery tasks to be processed in a Queue, this celery call is handled using reactor.callInThread The thing is that i want to unittest this code but a simple TestCase like the…
armonge
  • 3,108
  • 20
  • 36
2
votes
1 answer

twisted http server error

I am using python twisted module to intercept headers. I have the following script: from twisted.web import proxy, http from twisted.internet import reactor g_port = 8080 #port for listening g_request = () # action, params, method class…
torayeff
  • 9,296
  • 19
  • 69
  • 103
2
votes
2 answers

How is twisted's Deferred implemented?

Does it spawn a new thread underneath? If classical web server spawns a thread to serve a HTTP request and with Twisted web I have to spawn a Deferred() each time I want to query mysql - where's the gain? Looks like it doesn't make sens if it…
PawelRoman
  • 6,122
  • 5
  • 30
  • 40
2
votes
1 answer

Can someone please explain this Twisted unit test?

I just inherited some unit tests around Twisted Python, as shown below. While the test works, I don't understand it conceptually. Given the example below, can someone please explain the following things about it? Why does this unit test 'return…
ck.
  • 1,056
  • 1
  • 14
  • 25
1
vote
2 answers

how does "getChild" works in twisted

The twisted web documentation says that getChild has to be implemented in that way: class Hello(Resource): isLeaf = True def getChild(self, name, request): if name == '': return self return Resource.getChild(self,…
Fred
  • 11
  • 1
  • 2
1
vote
0 answers

Python Twisted library HTTP authentication problem

I ask you to help me finding the source of problems with the following code. I used page http://jcalderone.livejournal.com/53074.html as a guide. The only difference of my code is that resource isn't served from .rpy file. Also there is no cache()…
vian
  • 811
  • 2
  • 12
  • 27
1
vote
2 answers

Does twisted.web.http.HTTPClient implement a callback when ALL response content is received?

Documentation states that 'handleResponseEnd' is called when the response has been completely received. http://twistedmatrix.com/documents/11.0.0/api/twisted.web.http.HTTPClient.html#handleResponseEnd However, debugging appears to show that is not…
dicato
  • 684
  • 4
  • 13
1
vote
0 answers

Facing memory leak for SSL with python3.8, twisted 20.3.0, OpenSSL 1.1.1g

I am new to python. I am getting memory leak for HTTPs requests. Seems something is wrong around SSL. I am using python3.8, twisted 20.3.0, OpenSSL 1.1.1g. I tried downgrading openssl version to 1.0.2k, downgraded twisted to 19.10.0 but nothing…
1
vote
1 answer

Access socket options for twisted.web.client.Agent

How can i access underlying socket from twisted.web.client.Agent? I need to enable TCP_NODELAY on this socket.
Michael
  • 197
  • 1
  • 2
  • 10
1
vote
0 answers

How to use result of one threaded function in another deferred thread twisted

My Twisted server code: @app.route("/output", methods=['GET']) @inlineCallbacks @authenticate def predict(request): request_params = request.args logger.debug("request param are {}".format(request_params)) output =…
Roma Jain
  • 333
  • 4
  • 13
1
vote
1 answer

Twisted upgrade - now can't access site paths

I was running on Python2.6 and Twisted 15.0.0 with this: from twisted.python import usage from twisted.web import resource, server, static from twisted.application import internet class Options(usage.Options): optParameters = [ …
Brad M
  • 405
  • 6
  • 17
1
vote
1 answer

Store an instance of a connection - twisted.web

How I store an instance of a connection in twisted.web? I have seen request.getSession() but I searched and there are very few examples of how it is stored and retrieved later. Thanks. Update: I want to store the ldap connection in a session for…
Manu Mora
  • 332
  • 1
  • 2
  • 13