معرفی شرکت ها


directory-client-core-7.1.2


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Python common code for Directory API clients.
ویژگی مقدار
سیستم عامل -
نام فایل directory-client-core-7.1.2
نام directory-client-core
نسخه کتابخانه 7.1.2
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Department for International Trade
ایمیل نویسنده -
آدرس صفحه اصلی https://github.com/uktrade/directory-client-core
آدرس اینترنتی https://pypi.org/project/directory-client-core/
مجوز MIT
# directory-client-core [![code-climate-image]][code-climate] [![circle-ci-image]][circle-ci] [![codecov-image]][codecov] [![pypi-image]][pypi] [![semver-image]][semver] **Directory Client Core.** Common code for the Directory API clients. --- ## Requirements ## Installation ```shell pip install directory-client-core ``` ## Usage ```python from directory_client_core.base import AbstractAPIClient class MyAPIClient(AbstractAPIClient): version = 1 # passed as a header in all requests def get_something(self): return self.get(...) def create_sometime(self): return self.post(...) client = MyAPIClient( base_url='https://example.com/', api_key='test', sender_id='test-sender-id', timeout=2, ) response = client.get_something() ``` ### Caching The decorator `directory_client_core.helpers.fallback` can be used to cache the responses from the remote server, allowing the cached content to be later used if the remote server does not return the up to date live content (maybe it times out, maybe the server is down). This decorator also saves etag response headers to later expose them in requests and respect 304 (Not modified) response and serve already cached contents. ``` # settings.py DIRECTORY_CLIENT_CORE_CACHE_EXPIRE_SECONDS = 60 * 60 * 24 * 30 # 30 days # client.py from django.core.cache import caches from directory_client_core import helpers from directory_client_core.base import AbstractAPIClient class APIClient(AbstractAPIClient): version = 1 @helpers.fallback(cache=caches['fallback']) def get(self, *args, **kwargs): return super().get(*args, **kwargs) def retrieve(self): return self.get(url='/some/path/') ``` The `fallback` creates log entries when cache events occur. To reduce noise `DIRECTORY_CLIENT_CORE_CACHE_LOG_THROTTLING_SECONDS` can be set in settings. This will result in a log event being created only once every period of time. By default this means seeing "cache hit for url x" (for a given url) is shown once every 24 hours. ## Development $ git clone https://github.com/uktrade/directory-client-core $ cd directory-client-core $ 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-client-core/badges/issue_count.svg [code-climate]: https://codeclimate.com/github/uktrade/directory-client-core [circle-ci-image]: https://circleci.com/gh/uktrade/directory-client-core/tree/master.svg?style=svg [circle-ci]: https://circleci.com/gh/uktrade/directory-client-core/tree/master [codecov-image]: https://codecov.io/gh/uktrade/directory-client-core/branch/master/graph/badge.svg [codecov]: https://codecov.io/gh/uktrade/directory-client-core [pypi-image]: https://badge.fury.io/py/directory-client-core.svg [pypi]: https://badge.fury.io/py/directory-client-core [semver-image]: https://img.shields.io/badge/Versioning%20strategy-SemVer-5FBB1C.svg [semver]: https://semver.org


نیازمندی

مقدار نام
<3.0.0,>=2.21.0 requests
<3.0,>=1.2 monotonic
<5.2.0,>=4.0.1 sigauth
<4.0.0,>=3.2.18 django
<2.0.0,>=1.19.0 w3lib
==5.0.4 flake8
==1.0.0 freezegun
==4.1.0 pytest-django
==0.9.5 pytest-sugar
==5.4.0 pytest
- pytest-cov
- pytest-codecov
- GitPython
==1.8.0 requests-mock
<39.0.0,>=38.6.0 setuptools
<2.0.0,>=1.11.0 twine
<1.0.0,>=0.31.0 wheel


نحوه نصب


نصب پکیج whl directory-client-core-7.1.2:

    pip install directory-client-core-7.1.2.whl


نصب پکیج tar.gz directory-client-core-7.1.2:

    pip install directory-client-core-7.1.2.tar.gz