def landing(): form = SignUpStream() if form.validate_on_submit(): if form.stream.data == "flickr": return flickr_oauth.authorize(callback=url_for("handle_flickr_authorization", email=form.email.data), perms="read") elif form.stream.data == "instagram": return instagram_oauth.authorize(callback=url_for("handle_instagram_authorization", _external=True, email=form.email.data)) else: return "service unsupported" flash_errors(form) return render_template("landing.html", form=form)
def stats_auth(): service = request.args.get("service", None) if service == str(FLICKR): return flickr_oauth.authorize(callback=url_for('handle_flickr_authorization', stats="1"), perms="read") elif service == str(INSTAGRAM): return instagram_oauth.authorize(callback="http://digestif.me"+url_for('handle_instagram_authorization', stats="1"), scope="basic") elif session.get('digestif'): oauth_token = session.get("digestif")["a"] other_stream = Stream.query.filter_by(oauth_token=oauth_token).first_or_404() stream_encoded = hash_gen.encrypt(other_stream.user_id, other_stream.id) return redirect(url_for("stats", stream_encoded=stream_encoded)) else: return render_template("stats_login.html")