Beispiel #1
0
from oauth2client.client import flow_from_clientsecrets
from oauth2client.client import FlowExchangeError
import httplib2
import json
from flask import make_response
import requests

# init Flask
app = Flask(__name__)

CLIENT_ID = json.loads(open('client_secrets.json', 'r').read())['web']['client_id']
APPLICATION_NAME = "Random Noms"

# init SQLAlchemy
Base = declarative_base()
dblink = getDBLink()
engine = create_engine(dblink)
Base.metadata.bind = engine

DBSession = sessionmaker(bind = engine)
session = DBSession()

def createUser(login_session):
    """
    Creates a new user.

    Args:
        login_session: session dict, containing username, email, picture, etc

    Returns:
        The newly created user id.
Beispiel #2
0
from oauth2client.client import FlowExchangeError
import httplib2
import json
from flask import make_response
import requests

# init Flask
app = Flask(__name__)

CLIENT_ID = json.loads(open('client_secrets.json',
                            'r').read())['web']['client_id']
APPLICATION_NAME = "Random Noms"

# init SQLAlchemy
Base = declarative_base()
dblink = getDBLink()
engine = create_engine(dblink)
Base.metadata.bind = engine

DBSession = sessionmaker(bind=engine)
session = DBSession()


def createUser(login_session):
    """
    Creates a new user.

    Args:
        login_session: session dict, containing username, email, picture, etc

    Returns: