def api():
    try:
        logger.info("Another API request for an awesome quote has been made!")
        return json.dumps({"quote": unicode(quote_chuck_norris())}), 200
    except:
        logger.error(traceback.format_exc())
        return json.dumps(
            {"error": "Sorry, something bad happened with your request."}), 500
def main():
    try:
        logger.info("Another WEB request for an awesome quote has been made!")
        return render_template('index.html',
                               quote=unicode(quote_chuck_norris()),
                               background=get_random_background())
    except:
        logger.error(traceback.format_exc())
        return json.dumps(
            {"error": "Sorry, something bad happened with your request."}), 500