twisted

SSL handshake failures when no data was sent over Twisted TLSConnection

耗尽温柔 提交于 2019-12-31 05:35:12
问题 I start looking at implementing explicit FTP by extending the current Twisted FTP. Most of the code was straight forward and implementing AUTH, PBSZ, PROT was easy and I got a working secured control channel. My problem is with the data channel. The client side error is : SSL routines', 'SSL3_READ_BYTES', 'ssl handshake failure' It looks like SSL handshake and shutdown are called only when some data was send over the data channel. This affect the case when sending empty files or listing empty

Python-Twisted: Reverse Proxy to HTTPS API: Could not connect

三世轮回 提交于 2019-12-31 03:00:50
问题 I am trying to build a reverse-proxy to talk to certain APIs(like Twitter, Github, Instagram) that I can then call with my reverse-proxy to any (client) applications I want (think of it like an API-manager). Also, I am using an LXC-container to do this. For example, here is the simplest of code that I hacked from the examples on the Twisted Docs: from twisted.internet import reactor from twisted.web import proxy, server from twisted.python.log import startLogging from sys import stdout

How to deal with multiple serial ports for R/W using twisted?

五迷三道 提交于 2019-12-30 06:45:04
问题 Going through the twisted finger tutorial and seen the SO questions: Question-1 Question-2 However, I can't (yet) write a twisted program that can read & write from multiple serial ports, especially where the protocol involves reading single or multiple lines, and writing back to the device accordingly. What I am trying to do is open 2 pairs (i.e. total of 4) serial ports, for 2 modems. Communication with modems is using Hayes AT command set. While most of the command/response exchanges with

How to package Twisted program with py2exe?

一个人想着一个人 提交于 2019-12-29 04:44:06
问题 I tried to package a Twisted program with py2exe, but once I run the exe file I built, I got a "No module named resource" error. And I found the py2exe said: The following modules appear to be missing ['FCNTL', 'OpenSSL', 'email.Generator', 'email.Iterators', 'email.Utils', 'pkg_resources', 'pywintypes', 'resource', 'win32api', 'win32con', 'win32event', 'win32file', 'win32pipe', 'win32process', 'win32security'] So how do I solve this problem? Thanks. 回答1: I've seen this before... py2exe, for

Python Twisted JSON RPC

放肆的年华 提交于 2019-12-28 10:07:39
问题 Can anyone recommend some simple code to set up a simple JSON RPC client and server using twisted? I found txJSON-RPC, but I was wondering if someone had some experience using some of these anc could recommend something. 回答1: txJSONRPC is great. I use it and it works. I suggest you give it a try. SERVER: from txjsonrpc.web import jsonrpc from twisted.web import server from twisted.internet import reactor class Math(jsonrpc.JSONRPC): """ An example object to be published. """ def jsonrpc_add

Python Twisted JSON RPC

半世苍凉 提交于 2019-12-28 10:07:10
问题 Can anyone recommend some simple code to set up a simple JSON RPC client and server using twisted? I found txJSON-RPC, but I was wondering if someone had some experience using some of these anc could recommend something. 回答1: txJSONRPC is great. I use it and it works. I suggest you give it a try. SERVER: from txjsonrpc.web import jsonrpc from twisted.web import server from twisted.internet import reactor class Math(jsonrpc.JSONRPC): """ An example object to be published. """ def jsonrpc_add

multiprocessing memory usage and twisted/gevents

ε祈祈猫儿з 提交于 2019-12-25 10:00:32
问题 so my... err... app does the following: listen on a queue for 'work' spawns about 100 workers per server (across ~3 servers), each listening on the queue each worker basically does some networky stuff (ssh, snmp etc) (i/o intensive), then churns the output (very cpu intensive) i have it all working under multiprocessing and it works great. however: each worker is using way more memory than i would like (about 30MB RES, 450MB VIRT according to top). so i have two questions: what is the best

Twisted/Python - processing a large file line by line

风流意气都作罢 提交于 2019-12-25 08:20:09
问题 Have this code that reads a file and process it. The file is quite big, 12 million lines, so currently I split it manually into 1000 lines file and start each process sequentially for each 1000 lines (bash script). Is there a way to use Twisted to load a file and process it by 1000 items from one file (progress bar would be nice) without the need for me to split it manually? scanner.py import argparse from tqdm import tqdm from sys import argv from pprint import pformat from twisted.internet

Django / Twisted (or hendrix) help to start

江枫思渺然 提交于 2019-12-25 07:48:24
问题 I'm involve in a new proyect, let explain it briefly. We have an application server, this server can be interfaces with other systems using udp (this is a design policy, I can change it). Now we need a web app to collect the information sended by the application servers to show some reports and send back some configuration when we need. We are very interested in Django with Twisted (or Hendrix), we are very new in python world, I surf in Internet for days and so far I undersand some concepts

Twisted client protocol - attaching an interface frontend

风流意气都作罢 提交于 2019-12-25 04:03:28
问题 I am following the tutorial on writing a client/server pair in Twisted located here: http://twistedmatrix.com/documents/current/core/howto/clients.html I have everything working for the communication of my client and server, the system uses custom prefixes to denote how far it is into the 'conversation'. It sends a json string initially to set up the session, and then sends a file line by line. It's really just an exercise more than anything else. Client.py: class ClientProtocol(protocol