twisted

Python - Twisted and Unit Tests

I'm writing unit tests for a portion of an application that runs as an HTTP server. The approach I have been trying to take is to import the module that contains the HTTP server, start it. Then, the unit tests will use urllib2 to connect, send data, and check the response. Our HTTP server is using Twisted. One problem here is that I'...

How to use twistedweb with django on windows.

I'm looking for a super easy way to deploy django application on windows. Basically my plan is to set up any python web server with my app on it and the boundle everything together using py2exe into a single executable. I've tried using cherrypy however the newest (3.1.2) server doesn't work with Windows XP with Nod32 antivirus install...

Twisted: tcp server with push producer example?

I want to put together simple TCP server using Python and Twisted. The server starts up and waits for connection - I already have client - non-python application. Once connection is made server starts sending data at some interval (e.g. 1 sec). The server reads data from a static file (a record at a time), I should be able to figure ou...

Problem with Twisted and threads

Some of you that are more experienced using Twisted will probably judge me about using it together with threads - but I did it :). And now I am in somehow of a trouble - I am having an application server that listens for client requests and each time a new client connects it spawns another thread that I probably forget to properly close,...

Twisted: source IP address for outbound connections

I'm in the process of implementing a service -- written in Python with the Twisted framework, running on Debian GNU/Linux -- that checks the availability of SIP servers. For this I use the OPTIONS method (a SIP protocol feature), as this seems to be a commonplace practice. In order to construct correct and RFC compliant headers, I need...

How to defer a Django DB operation from within Twisted?

I have a normal Django site running. In addition, there is another twisted process, which listens for Jabber presence notifications and updates the Django DB using Django's ORM. So far it works as I just call the corresponding Django models (after having set up the settings environment correctly). This, however, blocks the Twisted app, ...

Does python twisted framework HttpClient access proxy?

I need to access a webpage using twisted.web.client.getPage() or a similar method to download a webpage from a known address (ie:www.google.com), the problem is: I am behind a proxy server and I couldn't find anywhere explanations on how to configure twisted or factories to use my proxy, any ideas? Bear in mind I have to specify user...

Testing twisted application - Load client

Hi, I've written a Twisted based server and I'd like to test it using twisted as well. But I'd like to write a load test starting a bunch of request at the same time. But I believe that I didn't get the concepts of Twisted, mainly client side, because I'm stucked with this problem: from twisted.internet import reactor, protocol f...

How do I fetch an XML document and parse it with Python twisted?

I want a fast way to grab a URL and parse it while streaming. Ideally this should be super fast. My language of choice is Python. I have an intuition that twisted can do this but I'm at a loss to find an example. ...

How non blocking read/write throught remote FileSystem

Hi, Is there a way to write and read files on a remote filesystem (such as NFS, SSHFS, or sambafs) in a way that read or write or even open return immediately with an error code ? In fact i'm using twisted and i want to know whether there is a safe way to access remote files without block my reactor ? Regards Fab ...

Is TCP Guaranteed to arrive in order?

If I send two TCP messages, do I need to handle the case where the latter arrives before the former? Or is it guaranteed to arrive in the order I send it? I assume that this is not a Twisted-specific example, because it should conform to the TCP standard, but if anyone familiar with Twisted could provide a Twisted-specific answer for my ...

How can I reduce memory usage of a Twisted server?

I wrote an audio broadcasting server with Python/Twisted. It works fine, but the usage of memory grows too fast! I think that's because some user's network might not be good enough to download the audio in time. My audio server broadcast audio data to different listener's client, if some of them can't download the audio in time, that m...

Python Twisted and database connections

Hi all, Our projects at work include synchronous applications (short lived) and asynchronous Twisted applications (long lived). We're re-factoring our database and are going to build an API module to decouple all of the SQL in that module. I'd like to create that API so both synchronous and asynchronous applications can use it. For the ...

Python, Asyncore and forks.

Hey there. Just for starters, I used Twisted and SocketServer with both ForkMixIn, ThreadMixIn and tried the "thread-pool" recepies. However, I wanted to make something particular work in Python. Alittle background. Previously I wrote in C a simple TCP deamon that would bind to a socket and listen on it, then pre-fork X many times and...

Non-blocking file access with Twisted

I'm trying to figure out if there is a defacto pattern for file access using twisted. Lots of examples I've looked at (twisted.python.log, twisted.persisted.dirdbm, twisted.web.static) actually don't seem to worry about blocking for file access. It seems like there should be some obvious interface, probably inheriting from abstract.Fil...

Is there any "remote console" for twisted server?

I am developing a twisted server. I need to control the memory usage. It is not a good idea to modify code, insert some memory logging command and restart the server. I think it is better to use a "remote console", so that I can type heapy command and see the response from the server directly. All I need is a remote console, I can build ...

Twisted/tkinter program crashes on exit.

I am running an app using twisted and tkinter that sends the result to the server, waits for the server to send back a confirmation, and then exits. So, the function I use to exit is this: def term(): '''To end the program''' reactor.stop() root.quit() root.destroy() This is then set in the factory and called in the da...

Twisted Spread suitable for multiplayer racing sim?

Do you think that Twisted Spread may be suitable (in terms of performance) for a multiplayer racing simulator? The rest of the application is based on Python-Ogre. Can Perspective Broker run upon (reliable?) UDP? ...

Checking files retrieved by Twisted's FTPClient.retrieveFile method for completeness.

I'm writing a custom ftp client to act as a gatekeeper for incoming multimedia content from subcontractors hired by one of our partners. I chose twisted because it allows me to parse the file contents before writing the files to disk locally, and I've been looking for occasion to explore twisted anyway. I'm using 'twisted.protocols.ftp.F...

Twisted errors in Scrapy spider

Hello, When I run the spider from the Scrapy tutorial I get these error messages: File "C:\Python26\lib\site-packages\twisted\internet\base.py", line 374, in fireEvent DeferredList(beforeResults).addCallback(self._continueFiring) File "C:\Python26\lib\site-packages\twisted\internet\defer.py", line 195, in addCallback callbackKeyword...