I am trying to avoid rate limiting and ip blacklisting while accessing an external api. I want to deploy a flask web app on google app engine.
I need a way to have the client send http requests to the external api (kind of turning the client into a http proxy) so it looks like the requests are from an actual user, not my application, and for the client to send the data back for processing.
here is an overview of the steps.
- A user visits my website
- The user visits a flask backend route
- The backend requires the data from a call to an external Api
- The backend somehow makes the frontend send a request, and gets the response from the api back
- The backend finishes processing this data and returns render_template
for this api, it is possible to send this request from any origin, i can copy a fetch request in by devtools and paste it in the console on another website and it still works.
Ex:
@app.route('/')
def index(x):
# make client send request to external api and get resonse
result = response.text
# process data
b = result + 1
return render_template('index.html', b=b)
tried websocket, somewhat worked but looking for a better solution
is there anyting like a reverse ajax?