# Path: foauth/providers.py
# class OAuthMeta(type):
#     def __init__(cls, name, bases, attrs):
#         if 'alias' not in attrs:
#             cls.alias = cls.__name__.lower()
#         if 'api_domain' in attrs and 'api_domains' not in attrs:
#             cls.api_domains = [cls.api_domain]
#         if 'provider_url' in attrs and 'favicon_url' not in attrs:
#             # Use a favicon service when no favicon is supplied
#             primary = 'https://getfavicon.appspot.com/%s' % cls.provider_url
#             domain = urlparse.urlparse(cls.provider_url).netloc
#             backup = 'https://www.google.com/s2/favicons?domain=%s' % domain
#             cls.favicon_url = '%s?defaulticon=%s' % (primary, urllib.quote(backup))
# 
#         if 'name' not in attrs:
#             cls.name = cls.__name__


import glob
import os
import requests
from flask import Flask
from werkzeug.contrib.fixers import ProxyFix
from flask_sslify import SSLify
from requests_runscope import RunscopeAdapter
from foauth.providers import OAuthMeta


app = Flask(__name__)
app.secret_key = os.environ.get('SECRET_KEY', '')
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL')
app.config['DEBUG'] = 'DEBUG' in os.environ
app.wsgi_app = ProxyFix(app.wsgi_app)
SSLify(app, subdomains=True)

app.requests_session = requests.Session()
if 'RUNSCOPE_BUCKET_KEY' in os.environ:
    runscope_adapter = RunscopeAdapter(os.environ['RUNSCOPE_BUCKET_KEY'])
    app.requests_session.mount('http://', runscope_adapter)

# Path: foauth/providers.py
# class OAuthMeta(type):
#     def __init__(cls, name, bases, attrs):
#         if 'alias' not in attrs:
#             cls.alias = cls.__name__.lower()
#         if 'api_domain' in attrs and 'api_domains' not in attrs:
#             cls.api_domains = [cls.api_domain]
#         if 'provider_url' in attrs and 'favicon_url' not in attrs:
#             # Use a favicon service when no favicon is supplied
#             primary = 'https://getfavicon.appspot.com/%s' % cls.provider_url
#             domain = urlparse.urlparse(cls.provider_url).netloc
#             backup = 'https://www.google.com/s2/favicons?domain=%s' % domain
#             cls.favicon_url = '%s?defaulticon=%s' % (primary, urllib.quote(backup))
# 
#         if 'name' not in attrs:
#             cls.name = cls.__name__


# Path: config.py
import glob
import os
import requests
from flask import Flask
from werkzeug.contrib.fixers import ProxyFix
from flask_sslify import SSLify
from requests_runscope import RunscopeAdapter
from foauth.providers import OAuthMeta



app = Flask(__name__)
app.secret_key = os.environ.get('SECRET_KEY', '')
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL')
app.config['DEBUG'] = 'DEBUG' in os.environ
app.wsgi_app = ProxyFix(app.wsgi_app)
SSLify(app, subdomains=True)

app.requests_session = requests.Session()
if 'RUNSCOPE_BUCKET_KEY' in os.environ:
    runscope_adapter = RunscopeAdapter(os.environ['RUNSCOPE_BUCKET_KEY'])
    app.requests_session.mount('http://', runscope_adapter)

    app.requests_session.mount('https://', runscope_adapter)