def switch_project(self, project_id):
    client = Client()
    result = client.switch_project({'project_id': project_id, 'username': self.username, 'password': self.psw})
    if (('error' in result) and (result['error'] is True)):
        raise OSMAuthException(result['data'])
    else:
        self.token = result['data']['id']
        self.project_id = result['data']['project_id']
        self.token_expires = result['data']['expires']
        self.save()
        return True
    return False
def switch_project(self, project_id):
    client = Client()
    result = client.switch_project({'project_id': project_id, 'username': self.username, 'password': self.psw})
    if (('error' in result) and (result['error'] is True)):
        raise OSMAuthException(result['data'])
    else:
        self.token = result['data']['id']
        self.project_id = result['data']['project_id']
        self.token_expires = result['data']['expires']
        self.save()
        return True
    return False