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.

Be sure to read the next Application Development article: Sinch Video Calling SDK Beta Now Available