NameError: name 'request' is not defined

Solution 1:

You appear to have forgotten to import the flask.request request context object:

from flask import request

Solution 2:

You are probably missing the following import statement:

from flask import request

that should be placed in the header of the file.

Solution 3:

This is because you missed the import statement

from flask import request