# Path: cliche/credentials.py
# class TwitterCredential(Credential):
#     """Information about Twitter User"""
# 
#     #: (:class:`int`) The primary key from :class:`Credential.id`.
#     id = Column(Integer, ForeignKey('credential.id'), primary_key=True)
# 
#     #: (:class:`int`) Twitter user id
#     identifier = Column(BigInteger, nullable=False, unique=True)
# 
#     #: (:class:`str`) The oauth token.
#     token = Column(String)
# 
#     #: (:class:`str`) The oauth secret token.
#     token_secret = Column(String)
# 
#     __tablename__ = 'twitter_credential'
#     __mapper_args__ = {'polymorphic_identity': 'twitter'}
#     __repr_columns__ = id, identifier
# 
# Path: cliche/web/db.py
# def get_database_engine():
# def get_database_engine_options():
# def get_session():
# def close_session(exception=None):
# def setup_session(app):


import collections
import datetime
import enum
from flask import Blueprint, flash, redirect, request
from flask import session as flask_session
from flask import url_for
from sqlalchemy.orm.exc import NoResultFound
from werkzeug.routing import BaseConverter, ValidationError
from ...credentials import TwitterCredential
from ...user import User
from ..db import session as sa_session
from .provider import twitter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Cliche provides Twitter login/join to use our service.
It widely uses Flask-OAuthlib_ as its OAuth framework.

.. _Flask-OAuthlib: https://flask-oauthlib.readthedocs.org/

"""




__all__ = ('OAuthVendorConverter', 'Vendor', 'Version', 'login', 'oauth_app',
           'oauth_authorized', 'vendors')


oauth_app = Blueprint('oauth', __name__)

Vendor = collections.namedtuple(
    'Vendor',
    ['name', 'credential_table', 'oauth_version', 'oauth_client', 'key_names']
)


class Version(enum.Enum):
    oauth1 = 1
    oauth2 = 2


vendors = [

# Path: cliche/credentials.py
# class TwitterCredential(Credential):
#     """Information about Twitter User"""
# 
#     #: (:class:`int`) The primary key from :class:`Credential.id`.
#     id = Column(Integer, ForeignKey('credential.id'), primary_key=True)
# 
#     #: (:class:`int`) Twitter user id
#     identifier = Column(BigInteger, nullable=False, unique=True)
# 
#     #: (:class:`str`) The oauth token.
#     token = Column(String)
# 
#     #: (:class:`str`) The oauth secret token.
#     token_secret = Column(String)
# 
#     __tablename__ = 'twitter_credential'
#     __mapper_args__ = {'polymorphic_identity': 'twitter'}
#     __repr_columns__ = id, identifier
# 
# Path: cliche/web/db.py
# def get_database_engine():
# def get_database_engine_options():
# def get_session():
# def close_session(exception=None):
# def setup_session(app):


# Path: cliche/web/social/oauth.py
import collections
import datetime
import enum
from flask import Blueprint, flash, redirect, request
from flask import session as flask_session
from flask import url_for
from sqlalchemy.orm.exc import NoResultFound
from werkzeug.routing import BaseConverter, ValidationError
from ...credentials import TwitterCredential
from ...user import User
from ..db import session as sa_session
from .provider import twitter

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Cliche provides Twitter login/join to use our service.
It widely uses Flask-OAuthlib_ as its OAuth framework.

.. _Flask-OAuthlib: https://flask-oauthlib.readthedocs.org/

"""




__all__ = ('OAuthVendorConverter', 'Vendor', 'Version', 'login', 'oauth_app',
           'oauth_authorized', 'vendors')


oauth_app = Blueprint('oauth', __name__)

Vendor = collections.namedtuple(
    'Vendor',
    ['name', 'credential_table', 'oauth_version', 'oauth_client', 'key_names']
)


class Version(enum.Enum):
    oauth1 = 1
    oauth2 = 2


vendors = [

    Vendor('twitter', TwitterCredential, Version.oauth1, twitter,