I'm new to Flask and have a question about one of my implementations.
I have a working prototype of what I'm trying to achieve, but I'm posting here as I don't believe it's the most pythonic (or SEO-compliant) solution.
Here's the situation:
- I have a web form that a user fills in.
- On submit, I use the input data as a parameter to call an external service API.
- Based on the the parameter, the API returns a URL.
- I would like to abstract all of this from the user and, on submit, open a new tab with the returned URL.
Here is how I currently have it implemented:
from flask import redirect
from app import app
from .forms import SomeForm
from util import APICall
@app.route('/page', methods=['GET', 'POST'])
def page():
# Declare form
form = SomeForm()
# Validate the form data
if form.validate_on_submit():
result_url = APICall(form.input.data).get_url()
return redirect(result_url)
This works. But is it the proper way of doing this? On the backend I see that it executes as a 302 redirect - will I be penalized (from an SEO standpoint) for having functionality that permanently results in a 302?
Aucun commentaire:
Enregistrer un commentaire