NameError name 'request' is not defined when trying to check for cookie -Python
Question: I'm encountering the following problem when I'm trying to check if a cookie
exists.

    
    
    import requests
    
    
    
    
    username = raw_input('Please enter your username: ')
    password = raw_input('Please enter your password: ')
    
    
    DATA = {
    "url": "http://example.com/index.php",
    "action": "do_login",
    "submit": "Login",
    "quick_login": "1",
    "quick_username": (username),
    "quick_password": (password),
    }
    
    requests.post("http://example.com/member.php", data=DATA)
    
    
    if 'mybbuser' in request.COOKIES.keys():
                                                 print("Correct")
    
    else:
        print("Wrong")
    

The error I'm getting:

NameError: name 'request' is not defined


Answer: Perhaps you need to store the response and look for the cookies there:

    
    
    resp = requests.post(...)
    if resp.cookies['blahblah']:
    

