Example #1
0

# Set allowable MIME Types for upload
ALLOWED_EXTENSIONS = ["txt", "pdf", "png", "jpg", "jpeg", "gif", "zip"]


def allowed_file(filename):
    return "." in filename and filename.rsplit(".", 1)[1] in ALLOWED_EXTENSIONS


app = Flask(__name__)
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
app.config["SECRET_KEY"] = "super secret key"
app.logger.addHandler(logging.StreamHandler(sys.stdout))
app.logger.setLevel(logging.ERROR)
app.config["SITE"] = "http://0.0.0.0:5000/"
app.config["DEBUG"] = True


# Setup twitter

# Twitter auth
oauth = OAuth(app)

twitter = oauth.remote_app(
    "twitter",
    consumer_key="cnZagtGnF7tdjBa0MS6LRfolp",
    consumer_secret="EDUP9tHatKeNwKUTQnlOHyscz5kBXyQWyXqkVANZFFxVYoNsx7",
    base_url="https://api.twitter.com/1.1/",
    request_token_url="https://api.twitter.com/oauth/request_token",
    access_token_url="https://api.twitter.com/oauth/access_token",
Example #2
0
import sys
import urllib
import logging
from datetime import datetime

import stripe
import requests

from flask import Flask, render_template, request, redirect, url_for, session, g, flash
from flask.ext.sqlalchemy import SQLAlchemy


# Config
app = Flask(__name__, static_url_path="/static")
app.config["SQLALCHEMY_DATABASE_URI"] = os.environ["DATABASE_URL"]
app.config["SITE"] = "https://connect.stripe.com"
app.config["AUTHORIZE_URI"] = "/oauth/authorize"
app.config["TOKEN_URI"] = "/oauth/token"
app.config["CLIENT_ID"] = os.environ["CLIENT_ID"]
app.config["SECRET_KEY"] = os.environ["SECRET_KEY"]
app.config["PUBLISHABLE_KEY"] = os.environ["PUBLISHABLE_KEY"]
app.config["JACKSON_CENTS"] = 2000

# Logging
app.logger.addHandler(logging.StreamHandler(sys.stdout))
app.logger.setLevel(logging.ERROR)

# SQLAlchemy Init
db = SQLAlchemy(app)

# Stripe Init