P
P
Pavel2017-08-18 14:35:30
Flask
Pavel, 2017-08-18 14:35:30

Flask how to redirect an external link and put new post data?

@blueprint.route('/redirect_me')
def redirect_me():
    payload = {'key': 'value'}
    return redirect('http://external.com', payload=payload)


How to put new data when redirecting?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pcdesign, 2017-08-18
@pcdesign

It's easier to give the browser an html page
On which the js script will be executed and make a post request.

$.post('http://external.com', {'key':'value'}, function(data){
    window.location = data.redirect;
});

https://api.jquery.com/jquery.post/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question