Python has a CGI-like standard called WSGI, which makes Web Services implementation much easier. But still not that easy, as I want it. So, spent a day writing my own "library", which you can find here, hosted on Google Code. Now you can write RESTful Web Services like this:
@url_pattern("/users/${username}/plans/${year}", ['GET', 'PUT'])I'm gonna use it to implement a very first version of Pomodoro Server. Some brief impressions:
def get_plans (username, year, request):
return "Inside get_plans('%s', '%s')" % (username, year)
- Python is very easy to learn and has a lot of great metaprogramming capabilities, very similar to Ruby. Great language, it's a pleasure to code it!
- Python's documentation is just awesome!
- Some Web Frameworks provide the similar functionality, but it's painful to install and comes with a lot of other heavyweight features, such as MVC and ORM.
- Google Code is a nice place to host your projects, though there are some limitations (for example, wiki is very basic and not compatible with anything else).
@Path("/users/{username}")Update2: found a very similar solution for Python called Bottle. Sample code:
public class UserResource {
@GET
@Produces("text/xml")
public String getUser(@PathParam("username") String userName) {
}
}
@route('/hello/:name')
def hello_name(name):
return 'Hello %s!' % name
run(host='localhost', port=8080)
It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command
ReplyDeleterpa training in bangalore
best rpa training in bangalore
RPA training in bangalore
rpa courses in bangalore
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeletepython Online training in chennai
python training institute in marathahalli
python training institute in btm
Python training course in Chennai
A huge article.The contents are so worthy.Thank you. Java training in Chennai | Certification | Online Course Training | Java training in Bangalore | Certification | Online Course Training | Java training in Hyderabad | Certification | Online Course Training | Java training in Coimbatore | Certification | Online Course Training | Java training in Online | Certification | Online Course Training
ReplyDelete