<s> from __future__ import print_function , unicode_literals <EOL> import logging <EOL> from rbtools . commands import Command <EOL> from rbtools . utils . users import get_authenticated_session <EOL> class Login ( Command ) : <EOL> """<STR_LIT>""" <EOL> name = '<STR_LIT>' <EOL> author = '<STR_LIT>' <EOL> option_list = [ <EOL> Command . server_options , <EOL> ] <EOL> def main ( self ) : <EOL> """<STR_LIT>""" <EOL> server_url = self . get_server_url ( None , None ) <EOL> api_client , api_root = self . get_api ( server_url ) <EOL> session = api_root . get_session ( expand = '<STR_LIT:user>' ) <EOL> was_authenticated = session . authenticated <EOL> if not was_authenticated : <EOL> session = get_authenticated_session ( api_client , api_root , <EOL> auth_required = True , <EOL> session = session ) <EOL> if session . authenticated : <EOL> if not was_authenticated or ( self . options . username and <EOL> self . options . password ) : <EOL> logging . info ( '<STR_LIT>' ) <EOL> else : <EOL> logging . info ( '<STR_LIT>' , <EOL> api_client . domain ) </s>
