Python-based API with WSDL generator - python

I do not have much experience in building web service, the one I am aware of is using Java with Apache axis, where we have tool like java2wsdl to compile written codes a WSDL file, but using Python as the programming language to build the web service, is there any possibility to compile written code to WSDL?
I have heard of a few frameworks for building Python-based web service, such as
flask: http://flask.pocoo.org/
soaplib: https://github.com/soaplib/soaplib
django-piston: https://bitbucket.org/jespern/django-piston/wiki/Home
soaplib seems like to have the ability to generate WSDL, but I think there are many more besides what listed above. Which frameworks are really relevant and suitable (with sufficient documentations for newbies) to build a Python-based web service?
Your feedback is highly appreciated.

Related

Is there any Google Apps Script-like solution for running Python?

I have been using Google Apps Script for a while and quite like how it can easily be deployed on the web. My question is: is there something similar to Google Apps Script for Python? That is, some where we can create a Python application and run it completely online without having to package or containerize the app.
I am also looking at Docker and Google's App Engine right now but haven't been able to get a clear picture of pros and cons.
Note: the practical application of what I am asking includes
manipulating large databases and let different clients run
manipulation scripts on their own cloud database themselves.
This is a very broad question, and not really the kind that Stackoverflow can help with. Trying reading How to create a Minimal, Complete, and Verifiable example?.
But to attempt to answer your question I need to break it down.
1) I assume that you are using the script editor / IDE for developing / debugging GScript (aka JavaScript) code. And that is the simplest way to develop Google Apps Script (GAS) software. There is no alternative to this for python or any other language. However it is not obligatory to use the IDE to write software that uses the Google Apps Script APIs.
2) This link, for example, is the Google Apps Script API quickstart that demonstrates how to use the GAS APIs from python.
3) However, to look at the big picture... you can regard GAS as an example of Serverless Computing, where the Google App Engine, AWS Lambda, and others (see the link) provide a straightforward environment for developing and deploying software without having to worry about packaging, containers, etc.
Docker might offer some advantages over traditional server deployment, but I would not regard it as an equivalent of serverless, as there is still a container environment to implement and manage.
The Pros and Cons of each are highly subjective, depending upon the nature of the problem your software needs to solve, and your starting point - if your business is already heavily into Azure or AWS then that might be the way to go. But if you require access to Google APIs for Maps, etc. then that might be the way to go, otherwise it probably boils down the specific services on offer, and cost.

Is it possible to build a python web app without any framework?

I am currently interesting in web development using python language, but evertime I'm searching for reference, we only given two frameworks option between Django and flask. Can we just develop web app without using any of those framework
Yes, you can build a web-app using no framework. However it will require you writing a large amount of boiler plate code to send, receive, and parse HTTP data. It is generally highly recommended that you use a framework in order to save yourself a large amount of time and effort, and to ensure the product that you build is good quality.
You will also struggle to find resources on building a web-app without a framework, while there are a wealth of resources available for working with existing frameworks.

How to expose an NLTK based ML(machine learning) Python Script as a Web Service?

Let me explain what I'm trying to achieve. In the past while working on Java platform, I used to write Java codes(say, to push or pull data from MySQL database etc.) then create a war file which essentially bundles all the class files, supporting files etc and put it under a servlet container like Tomcat and this becomes a web service and can be invoked from any platform.
In my current scenario, I've majority of work being done in Java, however the Natural Language Processing(NLP)/Machine Learning(ML) part is being done in Python using the NLTK, Scipy, Numpy etc libraries. I'm trying to use the services of this Python engine in existing Java code. Integrating the Python code to Java through something like Jython is not that straight-forward(as Jython does not support calling any python module which has C based extensions, as far as I know), So I thought the next option would be to make it a web service, similar to what I had done with Java web services in the past. Now comes the actual crux of the question, how do I run the ML engine as a web service and call the same from any platform, in my current scenario this happens to be Java. I tried looking in the web, for various options to achieve this and found things like CherryPy, Werkzeug etc but not able to find the right approach or any sample code or anything that shows how to invoke a NLTK-Python script and serve the result through web, and eventually replicating the functionality Java web service provides. In the Python-NLTK code, the ML engine does a data-training on a large corpus(this takes 3-4 minutes) and we don't want the Python code to go through this step every time a method is invoked. If I make it a web service, the data-training will happen only once, when the service starts and then the service is ready to be invoked and use the already trained engine.
Now coming back to the problem, I'm pretty new to this web service things in Python and would appreciate any pointers on how to achieve this .Also, any pointers on achieving the goal of calling NLTK based python scripts from Java, without using web services approach and which can deployed on production servers to give good performance would also be helpful and appreciable. Thanks in advance.
Just for a note, I'm currently running all my code on a Linux machine with Python 2.6, JDK 1.6 installed on it.
One method is to build an XML-RPC server, but you may wish to fork a new process for each connection to prevent the server from seizing up. I have written a detailed tutorial on how to go about this: https://speakerdeck.com/timclicks/case-studies-of-python-in-parallel?slide=68.
NLTK based system tends to be slow at response per request, but good throughput can be achieved given enough RAM.

Developing a RIA with Django - what technology stack?

I need to develop a web application with the following requirements:
Desktop like UI on the client side
Application deployment
Scalability (i.e. distributing the service on multiple servers)
What I thought of so far (as I love Python but haven't done much web development yet):
Django
Fabric (think I've read somewhere it's suited for this)
What I'm missing is:
How to create rich clients (probably need some javascript libraries for that)?
How to distribute the service?
For RIA you need to use some client technology in your templates.
See at Dojo or ExtJs.
ExtJs docs have example of Web Desktop app, but this library is not free for commercial project. I like more Dojo, and it is free.
Rich Internet Application: Javascript to do stuff asynchronously (AJAX). If you want a desktop-like interface on the web, it seems currently CoffeeScript is the way to go. It's a language that compiles into Javascript and adapted for rich interfaces.
Deployment: fabric (I think it's used to deploy Python apps).
Distribution: you deploy the code to one server.If you need to scale it up, you just need some additional servers (of course if you have specific usages like very high load on a database, you'll also need to add more database servers etc. But you get the idea).
using web browser as your client platform?

python web service for massive usage

I need to develp a real production webservice with python that will be used by another client application (with another progamming language ) .
I mean in real production webservice that this webserivce is will be used on critical environment that failure of the webserivce could cause major problems.
could someone provide /suggest which library to use in order to build such webservice with python ?
I know that python has the built in simpleXMLRPCServer but i don't know its quality and if its apropriate for real production usage .
Python has been used to develop production grade web services. There are numerous framework to do that. (Django, Twisted etc).
You expect certain quality attributes from production grade servers like availability, scalability etc. For mission critical applications, availability becomes important. Your application architecture and development may influence these attributes more than the frameworks that you may use to develop them with. You can plan to provide extensive fault tolerance, redundant systems and various other strategies to improve availability.
This applies to building application with Python framework too.
Twisted is a very good framework to develop networking and web applications. There are other frameworks available in Python too, for example : Tornado etc
You can go through certain twisted docs and also the following blog posts that can help understanding twisted better.
Twisted in 60 seconds series
A very good twisted introduction
I have been exploring twisted basics and have posted a few notes at my blog
Twisted docs:
http://twistedmatrix.com/documents/10.1.0/web/howto/xmlrpc.html
Python: deferToThread XMLRPC Server - Twisted - Cherrypy?
http://nullege.com/codes/search/SimpleXMLRPCServer.SimpleXMLRPCDispatcher/all/1
http://code.activestate.com/recipes/526625-twisted-xml-rpc-server-with-basic-http-authenticat/
http://www.artima.com/weblogs/viewpost.jsp?thread=156396
Some projects along this line:
http://freshmeat.net/projects/python-xmlrpc-server-w-ssl-authentication
Django:
https://launchpad.net/django-xmlrpc
http://djangosnippets.org/snippets/2078/
http://www.drdobbs.com/184405364
http://www.davidfischer.name/2009/06/django-with-jsonrpc-and-xmlrpc/
Others:
http://www.f4ntasmic.com/2009/03/simple-xmlrpc-server.html
I hope this helps. :)

Categories