# Python - Flask Middleware - Request Session Management Strategy

I am trying to determine what the most appropriate strategy for session management and authentication is for a middleware application which acts to receive a request, send it over to a database, and essentially echo those results back to the client.

I have a variety of functions that look like this

@app.route('/rest/results_mod', methods=['POST'])
@crossdomain(origin='*')
def rest_results_mod():
if request.method == 'POST':
with requests.session() as request_session:
request_session.trust_env = False
posted_form = request.form
text_search = posted_form['searchTerm']

params = urllib.parse.urlencode({"rs:searchTerm": "{0}".format(text_search)})

response = request_session.get(SHOW_SEARCH_MOD+'?{0}'.format(params))
#print(response.content)