Skip to content

Instantly share code, notes, and snippets.

View DEVANANDJALLA's full-sized avatar

DEVANANDJALLA

View GitHub Profile
@kgriffs
kgriffs / example.py
Created May 23, 2016 14:24
Example of using a Falcon middleware component to perform a permanent redirect
import falcon
from falcon import testing
class RedirectorComponent(object):
def process_request(self, req, resp):
raise falcon.HTTPMovedPermanently('http://example.org/foo')
class HelloResource(object):
@ib-lundgren
ib-lundgren / github_flask_oauth2.py
Created September 10, 2013 10:53
Example of how to use Flask with requests-oauthlib to fetch a GitHub user profile using an OAuth 2 token.
from requests_oauthlib import OAuth2Session
from flask import Flask, request, redirect, session, url_for
from flask.json import jsonify
import os
app = Flask(__name__)
# This information is obtained upon registration of a new GitHub
client_id = "<your client key>"