title: ImportError: cannot import name 'request' from 'flask'
body: <p>While running a py file through Pycharm I get the following error:</p>
  <pre><code>ImportError: cannot import name 'request' from 'flask'
  
  Traceback (most recent call last):
    File &quot;/root/PycharmProjects/pythonProject/smilecook-test-L_1-4/resources/token.py&quot;, line 2, in &lt;module&gt;
      from flask import request
    File &quot;/root/PycharmProjects/pythonProject/smilecook-test-L_1-4/venv/lib/python3.7/site-packages/flask/__init__.py&quot;, line 17, in &lt;module&gt;
      from werkzeug.exceptions import abort
    File &quot;/root/PycharmProjects/pythonProject/smilecook-test-L_1-4/venv/lib/python3.7/site-packages/werkzeug/__init__.py&quot;, line 1, in &lt;module&gt;
      from .serving import run_simple as run_simple
    File &quot;/root/PycharmProjects/pythonProject/smilecook-test-L_1-4/venv/lib/python3.7/site-packages/werkzeug/serving.py&quot;, line 16, in &lt;module&gt;
      import platform
    File &quot;/usr/lib/python3.7/platform.py&quot;, line 116, in &lt;module&gt;
      import sys, os, re, subprocess
    File &quot;/usr/lib/python3.7/subprocess.py&quot;, line 155, in &lt;module&gt;
      import threading
    File &quot;/usr/lib/python3.7/threading.py&quot;, line 8, in &lt;module&gt;
      from traceback import format_exc as _format_exc
    File &quot;/usr/lib/python3.7/traceback.py&quot;, line 5, in &lt;module&gt;
      import linecache
    File &quot;/usr/lib/python3.7/linecache.py&quot;, line 11, in &lt;module&gt;
      import tokenize
    File &quot;/usr/lib/python3.7/tokenize.py&quot;, line 35, in &lt;module&gt;
      from token import *
    File &quot;/root/PycharmProjects/pythonProject/smilecook-test-L_1-4/resources/token.py&quot;, line 2, in &lt;module&gt;
      from flask import request
  ImportError: cannot import name 'request' from 'flask' (/root/PycharmProjects/pythonProject/smilecook-test-L_1-4/venv/lib/python3.7/site-packages/flask/__init__.py)
  
  Process finished with exit code 1
  </code></pre>
  <p>Here's the code:</p>
  <pre><code>from http import HTTPStatus
  from flask import request
  from flask_restful import Resource
  from flask_jwt_extended import (
      create_access_token,
      jwt_refresh_token_required,
      create_refresh_token,
      get_jwt_identity,
      jwt_required,
      get_raw_jwt
  )
  
  from utils import check_password
  from models.user import User
  
  black_list = set()
  
  
  class TokenResource(Resource):
  
      def post(self):
  
          json_data = request.get_json()
  
          email = json_data.get('email')
          password = json_data.get('password')
  
          user = User.get_by_email(email=email)
  
          if not user or not check_password(password, user.password):
              return {'message': 'username or password is incorrect'}, HTTPStatus.UNAUTHORIZED
  
          access_token = create_access_token(identity=user.id, fresh=True)
          refresh_token = create_refresh_token(identity=user.id)
  
          return {'access_token': access_token, 'refresh_token': refresh_token}, HTTPStatus.OK
  
  
  class RefreshResource(Resource):
  
      @jwt_refresh_token_required
      def post(self):
          current_user = get_jwt_identity()
  
          token = create_access_token(identity=current_user, fresh=False)
  
          return {'token': token}, HTTPStatus.OK
  
  
  class RevokeResource(Resource):
  
      @jwt_required
      def post(self):
          jti = get_raw_jwt()['jti']
  
          black_list.add(jti)
  
          return {'message': 'Successfully logged out'}, HTTPStatus.OK
  </code></pre>
  <p>As far as I know the Flask request object contains the data that the client (eg a browser) sends to an app (URL parameters, POST data, etc.)
  as stated here: <a href="https://stackoverflow.com/questions/39319070/is-from-flask-import-request-identical-to-import-requests">is &quot;from flask import request&quot; identical to &quot;import requests&quot;?</a></p>