How can I send a GET request from my flask app to another site?

Install the requests module (much nicer than using urllib2) and then define a route which makes the necessary request – something like:

import requests
from flask import Flask
app = Flask(__name__)

@app.route('/some-url')
def get_data():
    return requests.get('http://example.com').content

Depending on your set up though, it’d be better to configure your webserver to reverse proxy to the target site under a certain URL.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)