Kontr门户rest api客户端
kontr-api的Python项目详细描述
kontr portal rest api客户端
kontr portal rest api client是门户中资源上的门户rest api包装器。 它支持crud操作和对实体的简单管理。
kontr 2是在fi muni上创建的项目,用于测试和执行学生的编程作业解决方案。
设置
使用pip安装和更新:
$ pip install kontr-api
简单示例
如何配置和使用api客户端的简单示例。
如何管理用户的示例。
fromkontr_apiimportKontrClientportal_url='https://localhost'username='admin'password='123456'kontr_client=KontrClient(url=portal_url,username=username,password=password)# List all userskontr_client.users.list()# Create new userkontr_client.users.create(username='xlogin',name='Test user',uco='123456')# Get useruser=kontr_client.users.get('xlogin')# Update user's nameuser['name']='new name'user.update()# or use the kontr_client.users.update({ 'name': 'new name' }, 'xlogin')# Set user's passworduser.set_password('Password.123')# Delete the useruser.delete()# or use the kontr_client.users.delete('xlogin')