Serverless image generator that uses XKCD comic as basis for _all_ excuses!
Clone or download
mislavcimpersak Merge pull request #27 from mislavcimpersak/hotfix/special_chars
no need to sanitize special chars that are also ascii chars
Latest commit 626dbb4 Dec 4, 2017

README.md

XKCD Excuse Generator

Generate your own excuse in a nifty comic style!

CircleCI Coverage Status


Go to xkcd-excuse.com and go from this:

to this:

using a simple form!


Originaly created as an example for Python Hrvatska meetup held on September 12, 2017 and for Python Belgrade meetup held on September 29, 2017 on which I gave a talk on serverless technology.


This repo is the backend part of the xkcd-excuse.com project. Code for the frontend part can be found in xkcd-excuse-front repo.

API Usage

If you are feeling extra wild you can use the API directly.

Send who, why and what with desired text as GET parameters to https://function.xkcd-excuse.com/v1/excuse

Example:

https://function.xkcd-excuse.com/v1/excuse/?who=programmer&why=my%20code%20is%20compiling&what=compiling

You get the simplest api response in the world:

{
    data: {
        image_url: "https://function.xkcd-excuse.com/media/50524f4752414d4d4552-4d5920434f444520495320434f4d50494c494e47-434f4d50494c494e47.png"
    }
}

Follow the given image_url value to get your excuse image.

Tech

Run with Python 3.6, created using Hug Framework, packaged with Zappa and served from AWS Lambda.

For frontend tech checkout the XKCD excuse front repo's README.

Infrastructure

Since this is a side project that will obviously never make any money, costs should idealy be minimal. Everything is served behind CloudFlare CDN, even the API that is served from AWS Lambda through AWS API Gateway. Frontend is served on Github Pages.

Legal

Original image

Original image created by Randall Munroe from XKCD.

Released under Creative Commons Attribution-NonCommercial 2.5 License.

Font

XKCD-Font created by iPython team.

Released under Creative Commons Attribution-NonCommercial 3.0 License.