Twisted and p2p applications - python

Can you tell me: could I use twisted for p2p-applications creating? And what protocols should I choose for this?

The best solution is to use the source code for BitTorrent. It was built with Twisted until they switched over to a C++ implementation called Utorrent.
Last known Twisted version of BitTorrent
http://download.bittorrent.com/dl/archive/BitTorrent-5.2.2.tar.gz
Older versions
http://download.bittorrent.com/dl/archive/
As an alternative, you also might want to take a look at Vertex.
It is a p2p library built on top of Twisted and comes with goodies like bypassing firewalls.
Its probably more complete than the other people's sample.
Link to Vertex
https://github.com/twisted/vertex

bittorrent twisted python client/server

Yes, twisted was used to create the initial version of Bittorrent. There are some opensource libraries to start from.

Yes, you can absolutely use twisted to create a p2p application. The one that comes first to my mind is Dtella (http://dtella.org/). It's uses the Direct Connect protocol.
They provide the source code, so that could get you started. I know that quite a few different university networks have DC hubs running. That seems to be the ideal use of this protocol.

Related

Python3 OpenID-library

I search for OpenID-library, which works with python3. I need to be an OpenID-provider and OpenID-consumer. tornado.auth provides only consumer functionality. What I can use to implement provider functionality, or how it can be implemented with tornado?
Does anybody uses python3-openid (fork of python-openid)? How it works?
python3-openid is the Python 3 version of python-openid, which has been more or less the reference library for OpenID in Python for several years. So it should implement everything you need. (Disclaimer: I ported python3-openid over and am the maintainer of the PyPI package).
However, for Tornado you will need a non-blocking implementation, ideally using Tornado's HTTPClient classes, and currently python3-openid does not provide that -- if you'd like to implement it, though, I'll gladly work on your pull request!
I went with pyoidc because it is listed as a "Certified Relying Party Library" on the official list of "Certified OpenID Connect Implementations" directly on the website for the OpenID standard. It runs on Python 3.5+ and also doubles as a full OAuth2.0 implementation.
I know this is an old post but it is still relevant. One should not screw around when it comes to things like security and authentication, it could very well save your job to stick with officially recommended or certified libraries - if anything goes wrong, at least your choice of authentication library can't be called into question!
have you tried this, i found it on pypi:
http://pypi.python.org/pypi/python3-openid/3.0.1

Python web service

I'm doing server/client application similar to Ubuntu Landscape (http://www.canonical.com/enterprise-services/ubuntu-advantage/landscape) for my school project.
The client part of application will send different informations (disk usage, packages etc.) to server. I know how to get informations and hot I'll handle them on the server side.
But I don't know how what is the best way to exchange informations. Would SOAP be ok or is there any better way for doing this? Messages can be large (for example a list of installed packages) or very small. I was looking at Twisted but don't know where to start. I have experience with SOAP in PHP, Java and C#.
And recommnedation is welcome, thanks
Look into XMLRPC or JSON-RPC which is likely supported in some why by all language through modules or packages.
SOAP is a complete bloat and widely considered as a failed hype.
I recommend using flask or smisk. Both frameworks are REST based, powerful, lightweight and pythonic. Flask is probably more mature and maintained. If you go down the SOAP road, you'll regret it sooner or later.

What are some modern Comet servers written in Python?

I've built my application in python (using greenthreads from eventlent) and I was supposed to use Orbited as comet server to pass requests from user-end javascript code to my application.
Sadly, I found that Orbited is dead, site is down for a few weeks and it lack python 2.7 support.
Could you recommend some good replacements?
You could build a comet server using gevent, meinheld, mongrel2, tornado, twisted, or uwsgi, all of which have long-polling examples. This list isn't exhaustive. You could also consider using WebSockets instead, several have WebSocket examples as well.
I haven't used it personally, but it seems that CometD has a Twisted-based implementation of its protocol.
It seems that for now the best option is to use Socket.io, which offer simple and feature-rich programming interface both on server and client side. The python options are:
gevent-socketio
SocketTornad.IO
socketIO-client
http://meteorserver.org/
Probably that won't register as an answer as you are looking for a server written in Python. Still, I would recommend this efficient server written in Perl. After all, IMHO, as an out-of-the-box/off-the-shelf solution it's as good as any other Python-based server can get.

WebService client libraries for Python and Perl

I want to access web service in Python or/and Perl scripts. What are the most popular and reliable libraries today?
I read this question, and I know about SOAPpy and ZSI. Can anybody say something about this libraries? Are they reliable enough for use in production?
If you're talking about SOAP then for Python I would definitely recommend suds :
https://fedorahosted.org/suds/
Checking couple of libraries for SOAP (including suds) only ZSI worked reliably for me. It is not complicated to use and it just works(tm). I recommend that.
Perl has fantastic CPAN libraries available for doing SOAP. Probably the easiest would be SOAP::Lite:
SOAP::Lite is a collection of Perl modules which provides a simple and lightweight interface to the Simple Object Access Protocol (SOAP) both on client and server side.
See more on the CPAN page.

What is the advantage of using Python Virtualbox API?

what is the advantage of using a python virtualbox API instead of using XPCOM?
The advantage is that pyvb is lot easier to work with.
On the contrary the documentation for the python API of XPCOM doesn't exist, and the API is not pythonic at all. You can't do introspection to find methods/attributes of an object, etc. So you have to check the C++ source to find how it works or some python scripts already written (like vboxshell.py and VBoxWebSrv.py).
On the other hand pyvb is really just python wrapper that call VirtuaBoxManager on the command line. I don't know if it's a real disadvantage or not?
I would generally recommend against either one. If you need to use virtualization programmatically, take a look at libvirt, which gives you cross platform and cross hypervisor support; which lets you do kvm/xen/vz/vmware later on.
That said, the SOAP api is using two extra abstraction layers (the client and server side of the HTTP transaction), which is pretty clearly then just calling the XPCOM interface.
If you need local host only support, use XPCOM. The extra indirection of libvirt/SOAP doesn't help you.
If you need to access virtualbox on a various hosts across multiple client machines, use SOAP or libvirt
If you want cross platform support, or to run your code on Linux, use libvirt.
From sun's site on VirtualBox python APIs:
SOAP allows to control remote VMs over
HTTP, while XPCOM is much more
high-performing and exposes certain
functionality not available with SOAP.
They use very different technologies
(SOAP is procedural, while XPCOM is
OOP), but as it is ultimately API to
the same functionality of the
VirtualBox, we kept in bindings
original semantics, so other that
connection establishment, code could
be written in such a way that people
may not care what communication
channel with VirtualBox instance is
used.
From that article, I'm having trouble seeing the difference between "python virtualbox API" and "XPCOM". Could you provide a link to the API you're thinking of?

Categories

Resources