def get_auth_str(user):
 token = default_token_generator.make_token(user)
 auth = '{0}:{1}'.format(user.username, token)
 return base64.b64encode(auth)

def get_auth_str ( user ) : token = default_token_generator . make_token ( user ) auth = '{0}:{1}' . format ( user . username , token ) return base64 . b64encode ( auth )
creates an auth string based on {username}:{token} .