# -*- coding: utf-8 -*-
import simplejson as json
import hashlib
import hmac
import logging

from dropbox.client import DropboxClient
from dropbox.client import DropboxOAuth2Flow
from flask import request
from flask import session
from flask import redirect
from flask import url_for
from flask import abort
from flask import render_template
from flask import flash
from flask import jsonify
import stripe
from validate_email import validate_email

from app import analytics
from app import app
from app import csrf
from app import db
from app.decorators import login_required_ajax
from app.kindleboxer import kindlebox
from app.kindleboxer import upload_welcome_pdf
from app.models import User
from app.models import KindleName


logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.INFO)
log.info("Starting app log...")

DEBUG = app.config.get('DEBUG', False)

DROPBOX_APP_KEY = app.config.get('DROPBOX_APP_KEY', '')
DROPBOX_APP_SECRET = app.config.get('DROPBOX_APP_SECRET', '')

KINDLE_DOMAINS = ('kindle.com', 'kindle.cn')

stripe.api_key = app.config.get('STRIPE_API_KEY', '')


@app.errorhandler(404)