Hackers and Slackers

Python

The language, the legend, the liberator. Includes Python hacks, tips, snippets and tutorials.

Scraping Data on the Web with BeautifulSoup

The honest act of robotically stealing data

There are plenty of reliable and open sources of data on the web. Datasets are freely released to the public domain by the likes of Kaggle, Google Cloud, and of course local & federal government. Like most things free and

Python Author imageTodd Birchard Author imagetodd Nov 11
Read

Create a REST API Endpoint Using AWS Lambda

Use Python and MySQL to Build an Endpoint

Now that you know your way around API Gateway, you have the power to create vast collections of endpoints. If only we could get those endpoints to actually receive and return some stuff.

We'll create a GET function which will

AWS Author imageTodd Birchard Author imagetodd Oct 29
Read

Creating Google Cloud Functions Running Python 3.7

GCP scores another victory by trivializing serverless functions

The more I explore Google Cloud's endless catalog of cloud services, the more I really like Google Cloud. This is why before moving forward, I'd like to be transparent that this blog has become little more than thinly veiled Google

Google Cloud Author imageTodd Birchard Author imagetodd Oct 18
Read

Structuring your Flask App Like a Responsible Adult

Leverage Blueprints, Flask-Assets, and the Application Factory.

When we first started developing in Flask, most of us took the 5 lines of code in the quick-start guide and ran with it. Compared to every other web framework, getting a "Hello world" to flash on screen without being

Flask Author imageTodd Birchard Author imagetodd Oct 15
Read

Extract Nested Data From Complex JSON

Steal our code and never manually walk through JSON objects again

We're all data people here, so you already know the scenario: it happens perhaps once a day, perhaps 5, or even more. There's an API you're working with, and it's great. It contains all the information you're looking for, but

Python Author imageTodd Birchard Author imagetodd Oct 10
Read

Reading and Writing to CSVs in Python

Playing with tabular data the native Python way.

Tables. Cells. Two-dimensional data. We here at Hackers & Slackers know how to talk dirty, but there's one word we'll be missing from our vocabulary today: Pandas.Before the remaining audience closes their browser windows in fury, hear me out.

Python Author imageTodd Birchard Author imagetodd Sep 27
Read

Flask Routing & Sessions: A Subtle Symphony

With great flexibility comes great responsibility

It isn't often you find somebody sad or miserable enough to detail the inner workings of web framework features, such as sessions or routing. This is understandably so; we use frameworks because presumably hate dealing with these things from scratch.

Flask Author imageTodd Birchard Author imagetodd Sep 19
Read