Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am madpsy on github.
* I am madpsy (https://keybase.io/madpsy) on keybase.
* I have a public key ASBct8mnmn7sUdv2-G_eefXAyCzngDttnhe7Qi0N-j3G7Ao
To claim this, I am signing this object:
@madpsy
madpsy / rest-server.py
Created December 13, 2016 17:00 — forked from miguelgrinberg/rest-server.py
The code from my article on building RESTful web services with Python and the Flask microframework. See the article here: http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask.ext.httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':