Dynamic website templates with Flask and Jinja2

Last month, we looked at using Python and Flask to handle the Twitter OAuth process and build requests to obtain tokens. We’ve used Twitter in these tutorials because of the large amount of easily digestible data available. However, since Twitter adheres to the standards set out by OAuth 1.0, the code we’ve used to sign and build requests can be modified to work with any third- party API using the same standard without a great deal of work. For years PHP has been a mainstay of template generation, but now with well-documented frameworks such as Flask, Sinatra and Handlebars, the ability to use powerful scripting languages greatly improves our ability to make great web services.