Home » Python (page 2)

Python

Python: Flask – Generating a static HTML page

Whenever I need to quickly spin up a web application Python’s Flask library is my go to tool but I recently found myself wanting to generate a static HTML to upload to S3 and wondered if I could use it for that as well. It’s actually not too tricky. If we’re in the scope of the app context then we ...

Read More »

AWS Lambda: Programatically scheduling a CloudWatchEvent

I recently wrote a blog post showing how to create a Python ‘Hello World’ AWS lambda function and manually invoke it, but what I really wanted to do was have it run automatically every hour. To achieve that in AWS Lambda land we need to create a CloudWatch Event. The documentation describes them as follows: Using simple rules that you ...

Read More »

AWS Lambda: Encrypted environment variables

Continuing on from my post showing how to create a ‘Hello World’ AWS lambda function I wanted to pass encrypted environment variables to my function. The following function takes in both an encrypted and unencrypted variable and prints them out. Don’t print out encrypted variables in a real function, this is just so we can see the example working! import ...

Read More »

Luigi: Defining dynamic requirements (on output files)

In my last blog post I showed how to convert a JSON document containing meetup groups into a CSV file using Luigi, the Python library for building data pipelines. As well as creating that CSV file I wanted to go back to the meetup.com API and download all the members of those groups. This was a rough flow of what ...

Read More »

A Problem With Python’s Code Blocks

So, this post was going to be completely different. I was going to do a post on how you can restrict the creation and scoping of certain objects using Python’s with code blocks. Unfortunately, with doesn’t restrict scope. Take the following code sample: with someManager() as i: # do something with i print(i) This will, unfortunately, work and print whatever ...

Read More »

Default Implementations Using Delegation

Hey everyone! It’s my first post of the new year! Usually, I do a bunch of book reviews at the beginning of the year, and I will certainly do that in upcoming posts. Also, don’t worry that I may have given up on my video series; I haven’t. I’m simply being a moron and doing other, less important things in ...

Read More »

Getting Every Microsecond Out of uWSGI

In recent articles, I covered performance tuning both HAProxy and NGINX. Today’s article will be similar, however we’re going to go further down the stack and explore tuning a Python application running via uWSGI. What Is uWSGI In order to deploy a web application written in Python, you would typically need two supporting components. The first is a traditional web ...

Read More »

Want to take your WEB dev skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • PHP Programming Cookbook
  • jQuery Programming Cookbook
  • Bootstrap Programming Cookbook
  • Building WEB Apps with Node.js
  • CSS Programming Cookbook
  • HTML5 Programming Cookbook
  • AngularJS Programming Cookbook