twisted

Chat comet site using python and twisted [closed]

╄→гoц情女王★ 提交于 2019-12-03 08:00:22
i want to build a site similar to www.omegle.com. can any one suggest me some ideas. I think its built usning twisted , orbiter comet server. Twisted is a good choice. I used it a few years ago to build a server for a browser-based online game I wrote - it kept track of clients, served them replies to Ajax requests, and used HTML5 Server-Sent DOM Events as well. Worked rather painlessly thanks to Twisted's good HTTP library. For a Python web framework, I personally favor Django. It's quick to get going with it, and it has a lot of functionality out of the box ("batteries included" as it says

How to write a DownloadHandler for scrapy that makes requests through socksipy?

◇◆丶佛笑我妖孽 提交于 2019-12-03 07:52:20
问题 I'm trying to use scrapy over Tor. I've been trying to get my head around how to write a DownloadHandler for scrapy that uses socksipy connections. Scrapy's HTTP11DownloadHandler is here: https://github.com/scrapy/scrapy/blob/master/scrapy/core/downloader/handlers/http11.py Here is an example for creating a custom download handler: https://github.com/scrapinghub/scrapyjs/blob/master/scrapyjs/dhandler.py Here's the code for creating a SocksiPyConnection class: http://blog.databigbang.com

Async spawing of processes: design question - Celery or Twisted

帅比萌擦擦* 提交于 2019-12-03 07:48:52
All: I'm seeking input/guidance/and design ideas. My goal is to find a lean but reliable way to take XML payload from an HTTP POST (no problems with this part), parse it, and spawn a relatively long-lived process asynchronously. The spawned process is CPU intensive and will last for roughly three minutes. I don't expect much load at first, but there's a definite possibility that I will need to scale this out horizontally across servers as traffic hopefully increases. I really like the Celery/Django stack for this use: it's very intuitive and has all of the built-in framework to accomplish

Managing multiple Twisted client connections

99封情书 提交于 2019-12-03 07:47:21
I'm trying to use Twisted in a sort of spidering program that manages multiple client connections. I'd like to maintain of a pool of about 5 clients working at one time. The functionality of each client is to connect to a specified IRC server that it gets from a list, enter a specific channel, and then save the list of the users in that channel to a database. The problem I'm having is more architectural than anything. I'm fairly new to Twisted and I don't know what options are available for managing multiple clients. I'm assuming the easiest way is to simply have each ClientCreator instance

Is TCP Guaranteed to arrive in order?

旧巷老猫 提交于 2019-12-03 06:20:49
问题 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 own peace of mind, that'd be appreciated :-) 回答1: As long as the two messages were sent on the same TCP connection , order will be maintained. If multiple

UDP client and server with Twisted Python

落花浮王杯 提交于 2019-12-03 05:20:01
问题 I want to create a server and client that sends and receives UDP packets from the network using Twisted. I've already written this with sockets in Python, but want to take advantage of Twisted's callback and threading features. However, I need help though with the design of Twisted. I have multiple types of packets I want to receive, but let's pretend there is just one: class Packet(object): def __init__(self, data=None): self.packet_type = 1 self.payload = '' self.structure = '!H6s' if data

Where can I find good python Twisted framework documentation, blog entries, articles, etc? [closed]

佐手、 提交于 2019-12-03 05:02:30
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm playing around with Twisted and documentation found on their homepage doesn't answer all my questions. The topic I am most interested at the moment is Twisted Application Framework. Also some open source servers using twisted framework would provide nice material for studying how it's all tied up together in

Redirecting before POST upload has been completed

拈花ヽ惹草 提交于 2019-12-03 04:47:59
I have form with file upload. The files to be uploaded actually are pictures and videos, so they can be quite big. I have logic which based on headers and first 1KB can determine if the rest will be processed or immediately rejected. In the later case I'd like to redirect client to error page without having to wait for upload to finish. The case is, that just sending response before POST is complete doesn't seem to work. The redirect gets ignored and if I close connection, browser complains with "Connection reset by peer" error. So the question is: is it even possible to do that in pure HTTP

Running a function periodically in twisted protocol

萝らか妹 提交于 2019-12-03 04:15:18
问题 I am looking for a way to periodically send some data over all clients connected to a TCP port. I am looking at twisted python and I am aware of reactor.callLater. But how do I use it to send some data to all connected clients periodically ? The data sending logic is in Protocol class and it is instantiated by the reactor as needed. I don't know how to tie it from reactor to all protocol instances... 回答1: You would probably want to do this in the Factory for the connections. The Factory is

Basic networking with Pygame

心不动则不痛 提交于 2019-12-03 03:49:52
问题 I need to do some basic networking for a Pygame project. Basically, it's a 2D single player or cooperative game. The networking only needs to support 2 players, with one as a host. The only information that needs to be sent is the positions of players, creeps and bullets. I've been reading around and Twisted keeps coming up, but I haven't done networking before and I'm not sure if that might be an overkill. So, is it possible for a relative newbie to implement networking in Pygame? Can anyone