Perfect, now let's add another file called twitter_auth.py in the twittervotes directory. We are going to create three functions in it but, first, let's add some imports:
from urllib.parse import parse_qslimport yamlfrom flask import Flaskfrom flask import render_templatefrom flask import requestimport oauth2 as oauthfrom core import read_configfrom core.models import RequestToken
First, we import the parser_qls from the urllib.parse module to parse the returned query string, and the yaml module so we can read and write YAML configuration files. Then we import everything we need to build our Flask application. The last third-party module that we are going to import here is the oauth2 module, which will help ...