Implementing web APIs with versions in python [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I am implementing a simple web application with python (3.x) and bottle. As the APIs I want to expose might change in the future, I would like to add the possibility to have different versions.
On this topic there are some insightful answers here, but unless versioning for web APIs is a proven bad idea I'd like to give it a try anyways.
Regarding my app: for example, while version 1.0 allows the following call through a POST /resource:
#post('/resource')
post_item(name=item_name, value=item_value)
a future version might do:
#post('/resource')
post_item(name=item_name, value=item_value, fullname=longer_item_name)
For simplicity assume the keyword parameters 'name', 'value', 'fullname' come from the FROM data fields:
<input name="name" type="text" />
Now, the first thing that comes to mind is inserting a version parameter at the beginning, something similar to what IP is doing with its headers:
post_item(v=1, name=item_name, value=item_value)
post_item(v=2, name=item_name, value=item_value, fullname=longer_item_name)
However, it seems a bit cumbersome. Is there any web micro-framework library that helps with this? Am I falling outside what a micro framework does?

It's definitely not a proven bad idea, more like a proven necessity. The issue is that there's very little agreement on the best way to handle it (beyond agreement at a high-level on URI-based approaches).
Apigee have some good articles on API versioning strategy here:
https://blog.apigee.com/taglist/versioning
Here's a good overview of how popular APIs handle versioning, along with some more resources that discuss versioning strategy:
http://www.lexicalscope.com/blog/2012/03/12/how-are-rest-apis-versioned/

Related

Starting with Python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Just wondering what the best way to get started learning Python to do backend engineering is and what the best framework to learn for it is (Pyramid, DJango etc...). I have done algorithms in school, build iOS apps and know Java, Scala, OCaml (lol), Racket (lol) and Objective C. I currently have to use Parse for my apps but want to build backend engineering skills. I'm thinking I might as well do the code academy course but the ones I've done from them don't seem in depth enough. Maybe an Udemy course? I want to get good enough to get an internship in backend engineering next summer. Need to find the best resources to do that before then. Thanks!!
While that question is quite open-ended, I personally think using Pyramid right out of the gates was super helpful. One of the pillars of this project is documentation, and their ideology is that you pay for what you use, giving developers the ability to customize their web applications to a good extent. Check out the docs here http://docs.pylonsproject.org/en/latest/docs/pyramid.html!
They also have excellent tutorials that guide you through the traditional "Hello, world!" application, and also more advanced stuff, like how to work with sqlalchemy to utilize databases in your web applications. This is how I learned essentially all of what I know about the framework! I would definitely recommend this, especially if you are just looking to start out and get your feet wet. But, as I said, this is my own opinion, and am sure that there are others with differing opinions on the matter. Best of luck!

Where to learn Pyramid by following practical examples? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
From the official website there's only things like "hello world" and a todo-list. Apparently Pyramid doesn't seem to be mainstream enough to spawn sufficient example tutorials, and I'm the kind of person that finds it more efficient to learn by following various sample projects. I think my Google-fu is not strong enough...
I'm actually pretty much brand new to back-end in general, so it would be even more helpful if someone can show me a variety of small and practical tutorials of how a Python backend works with Pyramid, all the way from setting up the configuration accordingly, passing data back and forth from the client side, and how data from the backend is hooked to the frontend template.
Thanks!
There are official tutorials supported by the Pylons Project.
http://docs.pylonsproject.org/projects/pyramid/en/latest/#tutorials
http://docs.pylonsproject.org/projects/pyramid/en/latest/quick_tutorial/index.html
There are community contributed tutorials as well, where the list of them is officially curated by the Pylons Project, but the tutorials themselves may not be official.
http://docs.pylonsproject.org/projects/pyramid-tutorials/en/latest/index.html#pyramid-tutorials
Pyramid projects:
Tutorias
Pyramid Bloggr tutorial: https://github.com/Pylons/pyramid_blogr
Heavy weight
Warehouse (the next generation Python package index in development): https://github.com/pypa/warehouse
Kotti CMS: https://github.com/Kotti/Kotti
Substance D CMS: http://www.substanced.net/

Looking for a lightweight Python web framework with minimal configuration [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I realise that web application frameworks are well documented, yet having tried 2 Python frameworks and found that are neither are suitable for my task, I hope you'll understand the need for this question.
I'm looking for a lightweight, "micro" framework for Python with the following features:
Basic HTML layout management
Features for HTML forms, tables etc.
Authentication and session management
Preferably integrable with mod_wsgi
Seamless importing of packages
That's it. You may ask why I need a framework for this at all - I don't. But it would save a lot of time, and I'm very surprised that I can't find something like this.
I'm reasonably advanced in Python but want to deal with the HTML and authentication as effortlessly as possible. I have a lot of existing code that I would like to be called from within the framework. I don't require an ORM or DAL, I would like my existing classes to continue to use their own MySQLdb driver. Inevitably, for authentication to be handled, an ORM or DAL will be included, but I just won't use it for anything other than authentication.
I have tried web2py and Grok, both supposedly lightweight, configuration-free frameworks, yet both were far too high-level.
Thanks in advance.
You should have a look at flask.
It comes with jinja as a template language.
It doesn't contain any ORM.
There are lots of well supported extensions for sessions, forms, ORM, etc.
You can also try WebPy.
The full (?) list of python web frameworks is given here. This slideshow compares 10 micro frameworks and should be of intrest. Not all of them will tick your boxes but at least it should give some hints as to their pros/cons.
I propose looking into web.py and Tornado.
Web.py is incredibly simple to use with a power of a full web framework.
I used it for OData implementation with great success.

Is there something better than django-piston? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
With 145 forks, 125 open issues, and the last release almost 2years ago, django-piston appears to be approaching abandonware and since the project I'm working on is likely to be a big one, I'd like to standardise on something that's going to be around for a while. Is there something resembling a consensus in the Python/Django community regarding a preference for REST API services? Even if it's one of those 145 forks? Ideally, I'd like to find something that plays nice with #jacobian's REST Worst Practises
check http://djangopackages.com/grids/g/api/ (django-tastypie looks very promising)
I also don't like Piston very much. Don't misunderstand me. It is (or was) a good app, though it has its issues. The main problem I had working with it that it hides Debugging information coming from django.
If you are absolutely unsure about what to use roll your own. With django 1.3 and class based views you got already a good way to add an API like this. If you need OAuth or other authentication methods you can simply check existing ways in piston or other apps and use them.
Two other REST packages that may be of interest :
http://django-rest-framework.org/
http://benoitc.github.com/dj-webmachine/index.html
It is worth mentioning about
django-tastypie
This is getting faster acceptance than the others.
Django Piston project seems to be abandonned.
Django rest framework has taken a large advantage with its second version.
Note that this is valid for now (2014), time may decide different.

Building a financial app with Django [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm building an app for a small business so I've to work with currencies, decimal numbers, etc... My goal is to create something like pulseapp.com.
I've searched for opensource projects to look and the only thing I had found was django-cashflow. This app uses python-money.
I've read some of the code and the ways it's coded seems a bit weird to me and it's not fully complete.
Is the app worth to take a deep look?
Does anyone know about another similar app?
Is the task difficult or a begginer like me could find a way to code it himself?
If you're dealing with currencies, you might look to satchmo's codebase. http://www.satchmoproject.com/ They're the current front-runner in Django e-commerce. I'm sure they have money modules.
Here you have something you might be interested:
Tryton with Django
I started to use python-money in an application a couple years ago, but had to abandon it due to some problem. I apologize for forgetting the exact problem, but I do remember for our use case it didn't make sense anyway... we just needed decimal fields.
I'd also be wary of django-cashflow not having any activity for 2 years, although the project is small enough it should be easy enough to fix any problems yourself.
For existing Django accounting apps I would suggest enhancing, or at least looking at, minibooks. NOTE: the license is AGPL v3 which could make it unusable for your environment.
Another road to travel would be to investigate porting OpenERP (also GPL IIRC) from Python/GTK to Django. Tryton might also be a starting point, it's GPL3 and IIRC a fork of OpenERP.
I've written a framework to help speed up the development of customised commerce aspects of django sites: Rollyourown shopping.
It lets your write your models yourself, and uses a declarative syntax to define a summary class, which handles calculating totals, caching and formatting values etc. It's pretty fast for my use cases, and very flexible: I've used it for online stores, billing for consulting-services and auction sites :-)
The current version works fine, but I'll be releasing a '1.0' version later this month as I decide on the final (stable) API details (names etc) and maybe some external reviews.

Categories