Skip to main content

云 CMS Python 驱动程序

项目描述

云 CMS Python 驱动程序

Cloud CMS API的基本驱动程序

使用 Python 3 运行

目前支持以下功能:

  • 使用 API 连接和刷新访问令牌
  • 读取平台、分支和存储库
  • 读取、查询、搜索、创建、更新和删除节点

安装

pip install cloudcms

例子

下面是一些如何使用此驱动程序的示例:

from cloudcms import CloudCMS

# Connect to Cloud CMS
client = CloudCMS()
platform = client.connect(filename='gitana.json')

# List repositories
repositories = platform.list_repositories()

# Read repository
repository = platform.read_repository('<repository_id>')

# List branches
branches = repository.list_branches()

# Read branch
branch = repository.read_branch('<branch_id>')

# Read Node
node = branch.read_node('<node_id>')

# Create node
obj = {
    'title': 'Twelfth Night',
    'description': 'An old play'
}
newNode = branch.create_node(obj)

# Query nodes
query = {
    '_type': 'store:book'
}
pagination = {
    'limit': 2
}
queried_nodes = branch.query_nodes(query, pagination)

# Search/Find nodes
find = {
    'search': 'Shakespeare',
    'query': {
        '_type': 'store:book'
    }
}
searched_nodes = branch.find_nodes(find)

测试

要对此驱动程序执行单元测试,请确保gitana.json驱动程序目录中有一个文件,然后运行:

python -m unittest tests

资源

支持

有关 Python 驱动程序的信息或问题,请通过support@cloudcms.com联系 Cloud CMS 。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

cloudcms-1.1.3.tar.gz (15.5 kB 查看哈希

已上传 source

内置分布

cloudcms-1.1.3-py3-none-any.whl (29.3 kB 查看哈希

已上传 py3