(self, data)
Deserialize a credential object from bytes.

        Args:
            data (bytes): serialized credential object.

        Raises:
            TypeError: if the data is not in bytes.
Deserialize a credential object from bytes.
Deserialize a credential object from bytes .
def from_bytes(self, data):
        """Deserialize a credential object from bytes.

        Args:
            data (bytes): serialized credential object.

        Raises:
            TypeError: if the data is not in bytes.
        """
        if not isinstance(data, bytes):
            raise TypeError('Data needs to be bytes.')

        try:
            data_dict = json.loads(data.decode('utf-8'))
        except ValueError as exc:
            raise TypeError('Unable to parse the byte string.') from exc

        if not 'username' in data_dict:
            raise TypeError('Username is not set.')
        if not 'password' in data_dict:
            raise TypeError('Password is not set.')
        self._credential = data_dict
def from_bytes ( self , data ) : if not isinstance ( data , bytes ) : raise TypeError ( 'Data needs to be bytes.' ) try : data_dict = json . loads ( data . decode ( 'utf-8' ) ) except ValueError as exc : raise TypeError ( 'Unable to parse the byte string.' ) from exc if not 'username' in data_dict : raise TypeError ( 'Username is not set.' ) if not 'password' in data_dict : raise TypeError ( 'Password is not set.' ) self . _credential = data_dict