跳转到主要内容

未提供项目描述

项目描述

ckanext-drupal-api

该扩展帮助同步CKAN和Drupal之间的页眉和页脚。

它使用两个版本的Drupal API - 核心REST API和JSON:API。

该扩展通过端点(在核心REST API的情况下可以配置)从Drupal门户接收数据,并在一定时间内将其缓存,这也可以通过Cache TTL配置选项进行更改,指定以秒为单位的值。如果您想更频繁地同步数据,需要设置较小的值。

要求

  • CKAN>=2.9
  • python>=3.7

安装

要安装ckanext-drupal-api

  1. 激活您的CKAN虚拟环境,例如

    . /usr/lib/ckan/default/bin/activate

  2. 克隆源并将其安装在虚拟环境上

    git clone https://github.com/DataShades/ckanext-drupal-api.git cd ckanext-drupal-api pip install -e . pip install -r requirements.txt

  3. drupal-api 添加到您的 CKAN 配置文件中的 ckan.plugins 设置(默认配置文件位于 /etc/ckan/default/ckan.ini)。

  4. 重启 CKAN。例如,如果您在 Ubuntu 上使用 Apache 部署了 CKAN

    sudo service apache2 reload

配置设置

该扩展提供以下配置选项

# The URL of connected drupal instance
ckanext.drupal_api.drupal_url = http://drupal.com

# Request timeout for API calls in seconds
# (optional, default: 5)
ckanext.drupal_api.timeout = 10

# Cache TTL in seconds
# (optional, default: 3600)
ckanext.drupal_api.cache.duration = 60

# HTTP auth credentials (optional)
ckanext.drupal_api.request.user = username
ckanext.drupal_api.request.pass = password

# API versions, only two options: core & json
# Because, there are two supported API versions: JSON API & RESTful Web Services
ckanext.drupal_api.api_version = json

# If you are using the core API version, you might face the situation when your endpoint differ from the default one
# In this case, you can specify the menu export endpoint through the config, e.g.:
ckanext.drupal_api.core.menu_export_endpoint = /api/v1/menu_export

开发者安装

要为开发安装 ckanext-drupal-api,激活您的 CKAN 虚拟环境并执行

git clone https://github.com/DataShades/ckanext-drupal-api.git
cd ckanext-drupal-api
python setup.py develop
pip install -r dev-requirements.txt

测试

要运行测试,请执行

pytest --ckan-ini=test.ini

发布 ckanext-drupal-api 的新版本

如果 ckanext-drupal-api 应该在 PyPI 上可用,您可以按照以下步骤发布新版本

  1. setup.py 文件中更新版本号。有关如何选择版本号的说明,请参阅 PEP 440

  2. 确保您有必要的最新版本包

    pip install --upgrade setuptools wheel twine

  3. 创建新版本的源和二进制发行版

    python setup.py sdist bdist_wheel && twine check dist/*
    

    修复您遇到的任何错误。

  4. 将源发行版上传到 PyPI

    twine upload dist/*
    
  5. 提交任何未处理的更改

    git commit -a
    git push
    
  6. 使用来自 setup.py 文件的版本号在 GitHub 上标记项目的全新版本。例如,如果 setup.py 中的版本号是 0.0.1,则执行

    git tag 0.0.1
    git push --tags
    

许可证

AGPL

项目详情


下载文件

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

源发行版

ckanext-drupal-api-0.6.0.tar.gz (24.2 kB 查看哈希)

上传时间

构建发行版

ckanext_drupal_api-0.6.0-py3-none-any.whl (25.4 kB 查看哈希)

上传时间 Python 3

支持者:

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面