Why Python is a Great Server Side Platform for Apps Consuming APIs

Every commonly used programming language and Web application framework has pros and cons and Python is no exception. Many of the arguments for and against using Python are anecdotal, circumstantial, and at times even philosophical in nature; however, the characteristics of developing a Web application in Python that consumes APIs are fairly unequivocal and are likely to include the following:

  • Python is a high-level language with good package support and several mature Web application frameworks such as Django, Flask and Tornado. Writing a Web application in Python is likely to produce results very rapidly given the number of supporting libraries, examples and code snippets available to developers. If you are familiar with Python and want to quickly build a Web application using it is an obvious choice;
  • In the case of a Web application, Python (like PHP, Ruby, and Node.js among others) is a server-side technology so naturally your code is going to be executed server-side. Making API calls to external APIs from a server-side application will therefore have a number of implications:
    • Given that API calls take place away from the browser Cross Origin Resource Sharing (CORS) will not be an issue for developers; 
    • Many APIs require credentials to be passed (generally speaking an API key) that identify the application calling the API. These credentials are confidential and thus need to be safely deployed and stored (the details of what this entails will be dependent on a range of factors – your organizational policies, security requirements, personal opinion and so on);
  • Using a framework that runs on the server naturally has implications for your user experience, given that code is executed away from the browser. Developing a “pure” Python Web application will be harder to achieve, and you will most likely need to rely on some JavaScript executed in the browser if you want to optimize the user experience with modal dialogs or similar features.

It’s clear that using Python to develop a Web application has its implications: On the whole it will prove a productive environment for a developer to use and as an application developer, you also have several options for setting up a server to run Python applications. For example, you can build your own installation on an operating system like Linux that runs on a system located in your garage, at a hosting service, in a data center, or in Amazon’s Elastic Computing cloud (EC2): Your installation may use the Python installation on the host operation system or possibly a Python runtime that executes inside a Docker container. Alternatively, you can activate a Python-ready platform using a platfom-as-a-service like Heroku or Joyent.

Chris Wood Chris is a freelance API specialist. His main interests are API management, Python and doing interesting stuff. Connect with Chris on Twitter

Comments

Comments(3)

aflavio

So weak the post. You should explain the difference between programming languages: php, rube, c#,... And why python would be used.

cwwood1975

Yes it could include a description of the differences and why to use Python in given circumstances. 

Programmable Web are looking for freelance contributors so why not give writing that article a shot?

eshan.sarpotdar

Very informative post there Chris. Yes, Python is definately a high-level language with good package support with advanced Web application frameworks. I'm sure the results are exceptional and quick as well. Following up on this, I came across and registered for a webinar on 'Building Amazing Web Applications Rapidly with Emerging Tech' and gain insights on how to leverage the emerging trends and technologies in web development to build a quality app rapidly, here is the registration link, it does look promising- http://j.mp/1QCH5nf