def auth(filename='asana_creds.json'): if os.path.exists(filename): with open(filename, 'r') as fp: data = json.load(fp) return data['secret'] elif is_mock() or is_local() : return None else: raise FileNotFoundError(f"{filename} could not be found!")
expiration_date = None if "expiration" in links[request_url]: expiration_date = datetime.datetime.strptime( links[request_url]["expiration"], "%Y-%m-%d") if expiration_date is not None and expiration_date < datetime.datetime.now( ): abort(404) return redirect(links[request_url]["url"]) @app.errorhandler(404) def page_not_found(error): return render_template('404.html', page=pageData["404"][0], site=site), 404 def get_email_cookie_key(request_url): return "{}_email".format(request_url) def get_id_cookie_key(request_url): return "{}_id".format(request_url) if __name__ == "__main__": if auth.is_mock() or auth.is_local(): app.run(host="localhost", port="8080") else: app.run()