(self)
return bytes(data_string, 'utf-8')
Convert the credential object into bytes for storage.
Convert the credential object into bytes for storage.
Convert the credential object into bytes for storage .
def to_bytes(self):
        """Convert the credential object into bytes for storage."""
        if not self._credential:
            return b''

        cred_obj = self._credential
        data = {
            'token': cred_obj.token,
            '_scopes': getattr(cred_obj, '_scopes', []),
            '_refresh_token': getattr(cred_obj, '_refresh_token', ''),
            '_id_token': getattr(cred_obj, '_id_token', ''),
            '_token_uri': getattr(cred_obj, '_token_uri', ''),
            '_client_id': getattr(cred_obj, '_client_id', ''),
            '_client_secret': getattr(cred_obj, '_client_secret', ''),
        }
        if cred_obj.expiry:
            data['expiry'] = cred_obj.expiry.isoformat()
        data_string = json.dumps(data)

        return bytes(data_string, 'utf-8')
def to_bytes ( self ) : if not self . _credential : return b'' cred_obj = self . _credential data = { 'token' : cred_obj . token , '_scopes' : getattr ( cred_obj , '_scopes' , [ ] ) , '_refresh_token' : getattr ( cred_obj , '_refresh_token' , '' ) , '_id_token' : getattr ( cred_obj , '_id_token' , '' ) , '_token_uri' : getattr ( cred_obj , '_token_uri' , '' ) , '_client_id' : getattr ( cred_obj , '_client_id' , '' ) , '_client_secret' : getattr ( cred_obj , '_client_secret' , '' ) , } if cred_obj . expiry : data [ 'expiry' ] = cred_obj . expiry . isoformat ( ) data_string = json . dumps ( data ) return bytes ( data_string , 'utf-8' )