Python web service - python

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.

Related

Python or Node.js for a Web app which interfaces with a USB devices?

I'm looking to develop a web app that controls Concept2 rowing gym equipment connected to the users computer via USB. I'm trying to decide what approach I should take in developing something like this.
Control of these devices has been achieved in the past both in python:
(https://github.com/uvd/PyRow)
and using node/jQuery:
(https://github.com/tijmenvangulik/ErgometerJS).
An SDK and documentation is provided by the developers of Concept2 gym equipment. DLL and CSafe commands are used to interface with the machines monitors.
(https://www.concept2.com/service/software/software-development-kit)
I'm looking for recommendations on how I should this tackle this project. At the moment python seems like the best approach however I have no idea how I can run these python files through a website interacting with the java script front end.
Any advice or pointers is appreciated.
David
You task looks like a simple SCADA solution with web interface.
You choice depends on whether you have experienced developers, who are able to use modern frameworks like Vue.js, Angular, React and others or not.
Really, in your particular case - monitoring equipment over web, you don't necessary need to invest a lot in your front-end - depends on your target audience. Is it a single service engineer? If yes, probably your front-end should be minimalistic, you can use Python with Twisted for static web server and build your frontend on bootstrap plus jquery. This is a fast win solution and you can implement it even if you've never worked with web.
More complex approach, requiring more engineering, is Python + Flask.
If you feel ready for modern frameworks, like Vue, React, Angular, then, possibly, you'd better look at NodeJs as a backend. They are better integrated with NodeJs and its package manager npm. You will need it to build the project on your server side; also some people treat it as a solid solution, when using the same language (javascript) for both backend and frontend. As for me, it doesn't really matter a lot.

SUDS or SOAPpy: google app engine python

Am very new on WSDL (SOAP) web service on GAE python,
i read some services like SOAPpy, SUDS
actually i couldn't able to figure-out which is best and easy for consuming the services.
Guys, Could you please share me your experiences with this or any other best services which i can use in my app.
Note: am using Windows7 for development with Python2.5, GAE 1.6.1v
SUDS is very nice and would be my preferred choice, but AFAIK doesn't work on GAE without modifications. It stores the WSDL cache on file system, while on GAE you'd want to store in memcached instead. Fixing it shouldn't be too difficult, if you search you should find a couple of blog postings on the issue. There are also several versions on github, perhaps some of those support GAE.
That's my blog post linked in the above comment. I'm glad it was helpful, but I'm surprised that my suds_memcache.py is still useful. I've gone ahead and made it a gist to make it easier to get to/find and so you can easily fork it:
https://gist.github.com/jjwatt/f263b00a2827d6decbfd42a0734872fb

Comet protocol and Django - I know some options but I can't seem to make them WORK

I'm very interested in making real-time web apps with Django. Unfortunately, I'm having more than a little bit of problem with setting things up. Some options I'm considering:
Orbited: Seems to be the choice for Django. Unfortunately, their domains have seemingly expired, and with it pretty much all of the documentation I'd need to get it working. I've followed a tutorial on http://mischneider.net/?p=125 but I'm having a mysterious error (see No handlers could be found for logger "stomp.py").
Meteor: I have to say, their website impresses me. Unfortunately, I'm running Windows and there seems to be an abject lack of documentation for anything regarding Windows. So I'm lost.
Cometd: Similar problem: Just don't understand installation.
Tornado: Requires pycurl, which in turn requires curl. Keeps throwing a problem with CURL_DIR then libcurl.lib. After hours of tinkering, have effectively thrown up my hands in frustration.
Please help. I'm very willing at this point to consider, well, ANYTHING. Well, at least if it's documented to a point where I can figure out how to install it and use it with Django.
Any help appreciated.
To do real-time web apps using comet techniques (or websocket) you need a server that can handle long-lived connections and a javascript client. Most of the comet libraries give you both (APE, orbited, etc). Working with websockets seems preferable to me, it's part of HTML5, the client code is really simple to implement, etc. I'd suggest finding an asynch framework/server you like, and implementing the live/real-time part of your project with it.
Gevent has a long-polling asynch chat demo built on Django. Gevent is quite popular and well documented.
Eventlet is a nice concurrent networking library, it's pretty well documented.
Twisted is of course the de facto asynchronous networking library for Python. Here's an example of using websockets with twisted.
Meinheld is a nice lightweight asynchronous webserver, it uses greenlet and has examples of usage with Django, and with websockets.
Uwsgi has great asynchronous support, and tons and tons of features, several examples of various approaches. It has a fair bit of documentation as well.
Also check out the bottle documentation for a good primer on asynchronous applications.
Take a look at EvServer : EvServer documentation.

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 simplest way to offer/consume web services in jython?

I have an application for Tomcat which needs to offer/consume web services. Since Java web services are a nightmare (xml, code generation, etc.) compared with what is possible in Python, I would like to learn from your experience using jython instead of java for offerring/consuming web services.
What I have done so far involves adapting http://pywebsvcs.sourceforge.net/ to Jython. I still get errors (namespaces, types and so), although some of it is succesful for the simplest services.
I've put together more details on how to use webservices in jython using axis. Read about it here: How To Script Webservices with Jython and Axis.
PyServlet helps you configure Tomcat to serve up Jython scripts from a URL. You could use this is a "REST-like" way to do some basic web services without much effort. (It is also described here.)
We used a similar home grown framework to provide a variety of data services in a large multiple web application very successfully.

Categories

Resources