[Tutor] if request.method == 'GET': NameError: global name 'request' is not defined

sudipto manna sudiptod19 at gmail.com
Sun Jan 17 18:15:22 EST 2016


Hi All,
I am running a python flask project for fetching the endpoint.

Please find the files attached.
Parent file: FlaskTest2.py
Endpoint Tester File: FlaskTendpointTester2.py

Process:
1. Execute the file FlaskTest2.py --> python FlaskTest2.py
# This will execute the file on the terminal and will be ready to listen
the requests coming RESTFUL API's written in python, s as to validate the
endpoint and checking the various methods like: GET, POST, PUT, DEETE etc.

2. Execute the FlaskTendpointTester2.py -- > python FlaskTendpointTester2.py
#This will open the terminal and indicate the local hit n which the
FlaskTest2.py is executed and will respond back wth all the response; like
the GET, POST, PUT, DELETE method will be called.

Issue#
When the endpoint file is executed its returning this error:
"if request.method == 'GET': NameError: global name 'request' is not
defined"

Here we are looking if the FlaskTest2.py file has any GET, POST, DELETE
method or not.

The error is coming on the terminal(on same Machine 2 working terminals are
opened) where the FlaskTest2.py is run.


Appreciate the help.

Regards,
Sudipto Manna


More information about the Tutor mailing list