Questions tagged [twisted]
Twisted is an event-driven networking engine, written in Python and implementing many different protocols.
3,457
questions
0
votes
1
answer
30
views
how to sleep in twisted LoopingCall
I have a work() method that calls functions that may invoke time.sleep. This clearly goes against recommended twisted usage.
Suppose one could replace LoopingCall with threads.deferToThread() and loop ...
0
votes
0
answers
12
views
How can twisted spawnProcess send ffmpeg filter_complex parameters with embedded quotes?
I am attempting to send these (simplified) parameters to ffmpeg via reactor.spawnProcess.
['-filter_complex', '"[0:v]setpts=PTS-STARTPTS,scale=-1:720 [a0];[a0]pad=w=1280:h=720:x=-1:y=-1:color=...
0
votes
1
answer
16
views
Python Twisted rpy module called multiple times - why?
I am programming Python the first day today. I am running Twisted webserver like this
/usr/bin/python3 -m twisted web --http=80 --path=/website
I wanted to add a scripted page using an .rpy file at /...
0
votes
0
answers
17
views
Implementing DNS APL Server with Twisted Python
I have been trying to create a DNS server with Twisted implementing a custom APL record query.
I have created a custom record class implementing IEncodableRecord to encode and decode and stringify the ...
1
vote
1
answer
47
views
scrapy run thousands of instance of the same spider
I have the following task:
in the DB we have ~2k URLs.
for each URL we need to run spider until all URLs will be processed.
I was running spider for a bunch of URLs (10 in one run)
I have used the ...
0
votes
0
answers
115
views
Building wheel for twisted-iocpsupport (pyproject.toml) did not run successfully
I am trying to install scrapy using pip but this happened. I already have a virtualenv and all.
Building wheel for twisted-iocpsupport (pyproject.toml) ... error
error: subprocess-exited-with-error
...
-2
votes
2
answers
78
views
GPS data storage system
I have a python script written using twisted module which is running on an ubuntu server as a service.
We have many gps devices which sends data every 10 sec. My job is to parse that data and store it ...
0
votes
2
answers
41
views
twisted.internet.interfaces.ITransport.write: Expected 0 positional arguments
This is my code:
from twisted.protocols.basic import LineReceiver
from twisted.internet.interfaces import ITransport
class AbcProtocol(LineReceiver):
transport: ITransport
def lineReceived(...
2
votes
1
answer
31
views
How to tell Twisted http server to ignore index files
I am serving a local directory with Twisted http server as:
from twisted.web.server import Site
from twisted.web.static import File
from twisted.internet import reactor, endpoints
resource = File('./'...
1
vote
1
answer
75
views
Issue running Scrapy with CrawlerProcess, TwistedScheduler, and a couple middlewares. Can run the crawler for a x time and it will eventually fail
As stated above after running the code for some time it fails. Logs do not show anything it will just cease to work.
I will show some of the warnings and errors I got as well as the code and settings ...
0
votes
0
answers
12
views
display the tls cyphersuit list a client propose during handshake
Is there a python tools like pyopenssl or twisted to get the list of the cyphersuite a client propose during the tls handshake ?
If so, how would you handle it ?
0
votes
0
answers
32
views
Got the following error message when importing twisted: "ImportError: cannot import name 'ParamSpec' from 'typing_extensions'"
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
results in the error message:
Traceback (most recent call last):
File "C:\Users\Pbaby\...
1
vote
1
answer
71
views
How can I run a simple twisted client on top of asyncio?
I have the following client code that I borrowed from twisted's docs:
https://docs.twistedmatrix.com/en/twisted-20.3.0/web/howto/client.html#the-agent
And I am trying to run it with asyncio since I am ...
0
votes
0
answers
26
views
Is there a way to add user sessions to twisted/klein web framework?
I used the twisted/klein micro framework to build a small web app. I would now like to add a part to the app which is password protected. Is there a way to do that? It seems like twisted has a way to ...
0
votes
2
answers
40
views
Problems connecting to MongoDB-Atlas with Twisted Python 3.7
I have an application running Twisted Python 3.7, and we're trying to convert it to run against Atlas and not our own managed MongoDB.
Our local MongoDB has no authentication so it was pretty straight ...
0
votes
2
answers
44
views
Twisted application ignoring a certain UNIX signal - is it possible?
Let's say we have the following situation:
kill <pid> sends SIGTERM
kill -<SIGNAL> <pid> sends <SIGNAL>
Sometimes, during development, I need to kill my application and restart ...
0
votes
0
answers
23
views
How to manage multiple sockets in Python?
How to open multiple sockets so that they work in parallel?
I found how to open one socket. What should I change to make it work for many?
if __name__ == '__main__':
import sys
from twisted....
1
vote
1
answer
59
views
Python twisted dataReceived method receive complete data at once
This is my code
`
class TestProtocol(Protocol):
def connectionMade(self):
print 'Got connection from', self.transport.client
def dataReceived(self, data):
print(data)
...
0
votes
0
answers
23
views
PyCharm complains about needing a Python 2 SDK when attempting to display Epydoc docstrings
I started to learn the Twisted Framework from a book called " Twisted Network Programming Essentials ". All good until I had to copy a server/client as an example on which I will follow some ...
0
votes
1
answer
769
views
ImportError: cannot import name 'ParamSpec' from 'typing_extensions' when using Django websockets with channels and twisted libraries
We did not update any lib or new lib added. During deployment of Django web application, got the following error:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/...
0
votes
1
answer
151
views
Python: How to use Twisted for secure TLS communication using my own keys? (private use, no paid CA)
I am trying to achieve secure TLS communication between my private Twisted client and my private Twisted server over the Internet, using my own cryptographic keys.
By "secure", I mean I want ...
-1
votes
1
answer
41
views
No callback results returned
I have a minimal script that uses twisted backend to return the GET request from yahoo finance. However, nothing is returned to the console but the code runs successfully. Am I missing something here. ...
0
votes
0
answers
29
views
twisted modification of the code does not work
The twisted -y command runs the.tac file, and the code modification does not take effect。
this is service.tac file code
from config import config
this is config.py file code
class Config:
def ...
0
votes
0
answers
175
views
youtube.com -> error.persotld.com -> Redirect without installing mitm certs
What I currently have :
I have a custom dns (powered by python twisted), installed in local network and used by all my local devices. That makes me able to customize the answers at the dns Level. The ...
0
votes
1
answer
46
views
Python Twisted: How to make the reactor poll a Pipe along with internet sockets?
I would like to use Twisted as a client/server manager that is part of regular Python objects.
The solution I am trying to implement is to isolate Twisted in its own process using multiprocessing....
0
votes
0
answers
66
views
Twisted object has no attribute 'connect'
I am working on a simple request class built with twisted to return the get request of a given url. It should callback by gatherResults to return the method for addCallBack and the response from the ...
0
votes
0
answers
67
views
twisted.internet.error.ReactorNotRestartable - How to restart a stopped Reactor in the same process
In a python function, I create a twisted reactor, use it and I stop the twisted Reactor using stop() command. I need to restart the twisted reactor in the same process but later time. It throws this ...
0
votes
0
answers
172
views
how to read rfid tag data in python?
I have an rfid that connect to my code shows that it connected. I am using twisted and uhf_reader library for that , but it did not read any data form the tag .
import logging
...
0
votes
1
answer
35
views
How to handle certificate in Twisted?
I have an existing code in Python Autobahn which connects to a Crossbar server using WS. I want to make it work on WSS.
I have changed Crossbar, and it is working fine. I have tested it using ...
0
votes
1
answer
67
views
Twisted sending files. python
I'm trying to transfer images and other files over the network using Twisted. I use for this the class "FileSender" and in particular the method "beginFileTransfer", which I use on ...
0
votes
0
answers
85
views
How do I write an asynchronous test for Twisted-based code using coroutines, pytest, and hypothesis?
I would like to write some new tests for a Twisted-based application which itself uses async def to define coroutines for asynchronous operations and I would like to use async def to define the tests ...
0
votes
0
answers
42
views
Support for TLSv1 in Python 3.10.5/Twisted 22.4.0
I recently upgraded a server based on Python 3.8.6 to Python 3.10.5
The Twisted listener in it allows various devices to connect
Some of those devices only have TLSv1.
The server code specifically ...
0
votes
1
answer
24
views
Twisted Tkinter Manual Data Input Not Working
I'm working on an application for use in a reception/office environment that allows for the sending of notices to specific offices/computers or in my case for testing at the moment globally to all ...
0
votes
0
answers
33
views
How to exclude certain file types when serving a directory using twisted
I am very new to twisted. I am serving a directory using twisted library from python. But i dont want to serve every file in that directory. I want to exclude json files or specific files from being ...
0
votes
1
answer
42
views
Process the body of 403 Forbidden with twisted.web.client
I have the general code:
client.getPage(url, headers=headers).addCallback(...).addErrback(errorHandler)
with the following error handler:
def errorHandler(self, error):
log.critical('Error: ', ...
0
votes
0
answers
31
views
Twisted transport.write and irregular prefixes
Does transport.write need a non-printable prefix to run?
Basically, sending over a test json object from a pyqt test client.
Object sent boils down to:
message = {"key": "Value"}
...
0
votes
1
answer
306
views
cannot use a bytes pattern on a string-like object with agent.request
I am learning - how to send a request to the browser with twisted then get the headers and print them. However, I find myself getting the following error when I run:
python agent_request.py http://...
0
votes
0
answers
81
views
Factory missing positional argument
The protocol creates a new LoopingCall instance that will write a single asterisk to the protocol's transport as the connection is established. It then replaces the LoopingCalls block with its factory ...
0
votes
1
answer
35
views
Connection refused on other side for simple protocol
My two dependent class methods develop a Protocol to define the connection strategy and a factory to open the connection. I have instigated a reactor to run this by connecting to a local host and a ...
0
votes
0
answers
37
views
Fire multiple delays sequentially
My class should take the current start time, and activate the end time by delaying it with clock by calling the function later by the given delay amount. Then I want to fire another clock that delays ...
0
votes
0
answers
20
views
How to use task.IDelayedCall in twisted
There are no examples online and I cannot seem to understand how to properly implement task.IDelayedCall.
For example, it requires an interface input, what would a simple code look like with its ...
1
vote
1
answer
108
views
Can't get Twisted to return application/json content-type
I have a server which is supposed to return JSON, I set the request response 'Content-Type' to 'application/json', yet from client side I always get text/html
this is the server printing response ...
0
votes
1
answer
39
views
Countdown of letters with reactor
I am learning twisted and have developed a simple python script that should count down each letter of the alphabet and stop the reactor when it gets to z. However, I am getting the following error:
...
0
votes
0
answers
59
views
Make callback to function
I want to make a callback to spider_opened with the values given in either deferred1, deferred2. This should pause and then immediately unpause the spiders. However, I am getting a fairly simple ...
0
votes
0
answers
32
views
Sum two dates with twisted given a timer for delay
I want to sum two datetime objects when passed as a string and called remotely. I want to add a delay on the callLater so it fires at a later period of choice. I want this timer to be equal to the ...
0
votes
0
answers
55
views
Looping deferLater with timer to choose schedule
I am working on a more complex example however I think this is a simplified version. The function should pause for 1 second, and given a delay to fire the function, we loop this call by intervals with ...
3
votes
1
answer
134
views
Highest fidelity I can get out of Twisted LoopingCallback is around 100ms (.1sec)
[Update]
I'm using Twisted 22.4.0 and Python 3.9.6
I'm trying to write an asynchronous application that must run an event loop at 250Hz. So far, Twisted is simply not fast enough to work for my ...
1
vote
1
answer
49
views
How can I use Twisted's ThrottlingFactory with their web client?
Problem
I need to execute HTTP requests and simulate high latency at the same time. I have encountered the Twisted package in Python which includes both an HTTP client and a ThrottlingFactory. The ...
0
votes
1
answer
101
views
How to implement execCommand of Twisted SSH server for use with fabric?
I implemented a Twisted SSH server to test a component that uses fabric to run commands on a remote machine via SSH. I have found this example but I don't understand how I have to implement the ...
1
vote
2
answers
72
views
Using Roslibpy on Android with Kivy and Buildozer
I am trying to create a simple Android app using Kivy and Buildozer that publishes a message to a Ros topic using roslibpy. The app works perfectly on Windows and Ubuntu, but crashes immediately on ...