# directory-cms-client
[![code-climate-image]][code-climate]
[![circle-ci-image]][circle-ci]
[![codecov-image]][codecov]
[![pypi-image]][pypi]
[![semver-image]][semver]
**Directory CMS client.**
Client for the Directory Content Management read-only API.
---
## Installation
$ pip install directory-cms-client
The api client expects the following settings:
| Setting | Notes |
| -----------------------------------------| ----------------------------------------------------------- |
| DIRECTORY_CMS_API_CLIENT_BASE_URL | |
| DIRECTORY_CMS_API_CLIENT_API_KEY | Unique to client. Retrieved during the on-boarding process. |
| DIRECTORY_CMS_API_CLIENT_SENDER_ID | Unique to client. Retrieved during the on-boarding process. |
| DIRECTORY_CMS_API_CLIENT_DEFAULT_TIMEOUT | |
| DIRECTORY_CMS_API_CLIENT_SERVICE_NAME | Unique to client, can be hardcoded. |
The following [directory client core settings](https://github.com/uktrade/directory-client-core) also apply to directory cms client:
| Setting | Notes |
| ---------------------------------------------------| ------------------------------------------------------|
| DIRECTORY_CLIENT_CORE_CACHE_EXPIRE_SECONDS | Duration to store the retrieved content in the cache. | |
| DIRECTORY_CLIENT_CORE_CACHE_LOG_THROTTLING_SECONDS | Duration to throttle log events for a given url for. |
And also specify a cache with name `cms_fallback`:
```
CACHES = {
'cms_fallback': ...
}
```
Once that is done the API client can be used:
```py
from directory_api_client.client import cms_api_client
```
## Development
```shell
$ git clone https://github.com/uktrade/directory-cms-client
$ cd directory-cms-client
$ [create virtual environment and activate]
$ make test_requirements
```
## Publish to PyPI
The package should be published to PyPI on merge to master. If you need to do it locally then get the credentials from rattic and add the environment variables to your host machine:
| Setting |
| --------------------------- |
| DIRECTORY_PYPI_USERNAME |
| DIRECTORY_PYPI_PASSWORD |
Then run the following command:
$ make publish
[code-climate-image]: https://codeclimate.com/github/uktrade/directory-cms-client/badges/issue_count.svg
[code-climate]: https://codeclimate.com/github/uktrade/directory-cms-client
[circle-ci-image]: https://circleci.com/gh/uktrade/directory-cms-client/tree/master.svg?style=svg
[circle-ci]: https://circleci.com/gh/uktrade/directory-cms-client/tree/master
[codecov-image]: https://codecov.io/gh/uktrade/directory-cms-client/branch/master/graph/badge.svg
[codecov]: https://codecov.io/gh/uktrade/directory-cms-client
[pypi-image]: https://badge.fury.io/py/directory-cms-client.svg
[pypi]: https://badge.fury.io/py/directory-cms-client
[semver-image]: https://img.shields.io/badge/Versioning%20strategy-SemVer-5FBB1C.svg
[semver]: https://semver.org
Raw data
{
"_id": null,
"home_page": "https://github.com/uktrade/directory-cms-client",
"name": "directory-cms-client",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Department for International Trade",
"author_email": "",
"download_url": "",
"platform": null,
"description": "# directory-cms-client\n\n[![code-climate-image]][code-climate]\n[![circle-ci-image]][circle-ci]\n[![codecov-image]][codecov]\n[![pypi-image]][pypi]\n[![semver-image]][semver]\n\n**Directory CMS client.**\n\nClient for the Directory Content Management read-only API.\n---\n\n## Installation\n\n $ pip install directory-cms-client\n\nThe api client expects the following settings:\n\n| Setting | Notes |\n| -----------------------------------------| ----------------------------------------------------------- |\n| DIRECTORY_CMS_API_CLIENT_BASE_URL | |\n| DIRECTORY_CMS_API_CLIENT_API_KEY | Unique to client. Retrieved during the on-boarding process. |\n| DIRECTORY_CMS_API_CLIENT_SENDER_ID | Unique to client. Retrieved during the on-boarding process. |\n| DIRECTORY_CMS_API_CLIENT_DEFAULT_TIMEOUT | |\n| DIRECTORY_CMS_API_CLIENT_SERVICE_NAME | Unique to client, can be hardcoded. |\n\nThe following [directory client core settings](https://github.com/uktrade/directory-client-core) also apply to directory cms client:\n\n| Setting | Notes |\n| ---------------------------------------------------| ------------------------------------------------------|\n| DIRECTORY_CLIENT_CORE_CACHE_EXPIRE_SECONDS | Duration to store the retrieved content in the cache. | |\n| DIRECTORY_CLIENT_CORE_CACHE_LOG_THROTTLING_SECONDS | Duration to throttle log events for a given url for. |\n\nAnd also specify a cache with name `cms_fallback`:\n\n```\nCACHES = {\n 'cms_fallback': ...\n}\n```\n\nOnce that is done the API client can be used:\n\n```py\nfrom directory_api_client.client import cms_api_client\n```\n\n## Development\n\n```shell\n$ git clone https://github.com/uktrade/directory-cms-client\n$ cd directory-cms-client\n$ [create virtual environment and activate]\n$ make test_requirements\n```\n\n## Publish to PyPI\n\nThe package should be published to PyPI on merge to master. If you need to do it locally then get the credentials from rattic and add the environment variables to your host machine:\n\n| Setting |\n| --------------------------- |\n| DIRECTORY_PYPI_USERNAME |\n| DIRECTORY_PYPI_PASSWORD |\n\nThen run the following command:\n\n $ make publish\n\n[code-climate-image]: https://codeclimate.com/github/uktrade/directory-cms-client/badges/issue_count.svg\n[code-climate]: https://codeclimate.com/github/uktrade/directory-cms-client\n\n[circle-ci-image]: https://circleci.com/gh/uktrade/directory-cms-client/tree/master.svg?style=svg\n[circle-ci]: https://circleci.com/gh/uktrade/directory-cms-client/tree/master\n\n[codecov-image]: https://codecov.io/gh/uktrade/directory-cms-client/branch/master/graph/badge.svg\n[codecov]: https://codecov.io/gh/uktrade/directory-cms-client\n\n[pypi-image]: https://badge.fury.io/py/directory-cms-client.svg\n[pypi]: https://badge.fury.io/py/directory-cms-client\n\n[semver-image]: https://img.shields.io/badge/Versioning%20strategy-SemVer-5FBB1C.svg\n[semver]: https://semver.org\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python API client for Directory CMS.",
"version": "12.3.3",
"project_urls": {
"Homepage": "https://github.com/uktrade/directory-cms-client"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d62409af608107b85c109a49a262820a6330db3db14f07481aaf08eb47736ae1",
"md5": "504739ac694e4894fcdddc083d5f5533",
"sha256": "55a55d9516e2d0c688cc92e6061d751fb63742573e79c3c1d24345057995ff0b"
},
"downloads": -1,
"filename": "directory_cms_client-12.3.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "504739ac694e4894fcdddc083d5f5533",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8942,
"upload_time": "2024-01-19T21:29:25",
"upload_time_iso_8601": "2024-01-19T21:29:25.212934Z",
"url": "https://files.pythonhosted.org/packages/d6/24/09af608107b85c109a49a262820a6330db3db14f07481aaf08eb47736ae1/directory_cms_client-12.3.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-19 21:29:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "uktrade",
"github_project": "directory-cms-client",
"travis_ci": false,
"coveralls": true,
"github_actions": false,
"circle": true,
"lcname": "directory-cms-client"
}