def generate_login_url(self, scopes=None, redirect_uri=None):
url = self.base_url + "<STR_LIT>"<EOL>split = list(urlparse(url))<EOL>params = {<EOL>"<STR_LIT>": self.client_id,<EOL>"<STR_LIT>": "<STR_LIT:code>", <EOL>}<EOL>if scopes:<EOL><INDENT>params["<STR_LIT>"] = OAuthScopes.serialize(scopes)<EOL><DEDENT>if redirect_uri:<EOL><INDENT>params["<STR_LIT>"] = redirect_uri<EOL><DEDENT>split[<NUM_LIT:4>] = urlencode(params)<EOL>return urlunparse(split)<EOL>
Generates a url to send users so that they may authenticate to this
application.  This url is suitable for redirecting a user to.  For
example, in `Flask`_, a login route might be implemented like this::

   @app.route("/login")
   def begin_oauth_login():
       login_client = LinodeLoginClient(client_id, client_secret)
       return redirect(login_client.generate_login_url())

.. _Flask:: http://flask.pocoo.org

:param scopes: The OAuth scopes to request for this login.
:type scopes: list
:param redirect_uri: The requested redirect uri.  The login service
                     enforces that this is under the registered redirect
                     path.
:type redirect_uri: str

:returns: The uri to send users to for this login attempt.
:rtype: str