main.py
def do_auth(self):
        ''' Perform OAuth2 flow mostly on command-line and retrieve information of the
            authorised user's current account information, rather than from joint account, 
            if present.
        '''

        print("Starting OAuth2 flow...")
        token = input("If you already have a token, enter it now, otherwise press enter to continue")
        if token == "":
            self._api_client.start_auth()
        else:
            self._api_client.existing_access_token(token)

        print("OAuth2 flow completed, testing API call...")
        response = self._api_client.test_api_call()
        if "authenticated" in response:
            print("API call test successful!")
        else:
            error("OAuth2 flow seems to have failed.")
        self._api_client_ready = True

        print("Retrieving account information...")
        success, response = self._api_client.api_get("accounts", {})
        if not success or "accounts" not in response or len(response["accounts"]) < 1:
            error("Could not retrieve accounts information")
        
        # We will be operating on personal account only.
        for account in response["accounts"]:
            if "type" in account and account["type"] == "uk_retail":
                self._account_id = account["id"]
                print("Retrieved account information.")
                break

        if self._account_id is None:
            error("Could not find a personal account")
            return
 Perform OAuth2 flow mostly on command-line and retrieve information of the
            authorised user's current account information, rather than from joint account, 
            if present.
        
Perform OAuth2 flow mostly on command-line and retrieve information of the
authorised user's current account information, rather than from joint account,
if present.
Perform OAuth2 flow mostly on command - line and retrieve information of the authorised user ' s current account information rather than from joint account if present .
def do_auth(self):
        print("Starting OAuth2 flow...")
        token = input("If you already have a token, enter it now, otherwise press enter to continue")
        if token == "":
            self._api_client.start_auth()
        else:
            self._api_client.existing_access_token(token)
        print("OAuth2 flow completed, testing API call...")
        response = self._api_client.test_api_call()
        if "authenticated" in response:
            print("API call test successful!")
        else:
            error("OAuth2 flow seems to have failed.")
        self._api_client_ready = True
        print("Retrieving account information...")
        success, response = self._api_client.api_get("accounts", {})
        if not success or "accounts" not in response or len(response["accounts"]) < 1:
            error("Could not retrieve accounts information")
        for account in response["accounts"]:
            if "type" in account and account["type"] == "uk_retail":
                self._account_id = account["id"]
                print("Retrieved account information.")
                break
        if self._account_id is None:
            error("Could not find a personal account")
            return
def do_auth ( self ) : print ( "Starting OAuth2 flow..." ) token = input ( "If you already have a token, enter it now, otherwise press enter to continue" ) if token == "" : self . _api_client . start_auth ( ) else : self . _api_client . existing_access_token ( token ) print ( "OAuth2 flow completed, testing API call..." ) response = self . _api_client . test_api_call ( ) if "authenticated" in response : print ( "API call test successful!" ) else : error ( "OAuth2 flow seems to have failed." ) self . _api_client_ready = True print ( "Retrieving account information..." ) success , response = self . _api_client . api_get ( "accounts" , { } ) if not success or "accounts" not in response or len ( response [ "accounts" ] ) < 1 : error ( "Could not retrieve accounts information" ) for account in response [ "accounts" ] : if "type" in account and account [ "type" ] == "uk_retail" : self . _account_id = account [ "id" ] print ( "Retrieved account information." ) break if self . _account_id is None : error ( "Could not find a personal account" ) return
Perform OAuth2 flow mostly on command-line and retrieve information of the
authorised user's current account information, rather than from joint account,
if present.
Perform OAuth2 flow mostly on command - line and retrieve information of the authorised user ' s current account information rather than from joint account if present .
''' Perform OAuth2 flow mostly on command-line and retrieve information of the
            authorised user's current account information, rather than from joint account, 
            if present.
        ''' # We will be operating on personal account only.
self