Skip to main content

A python client for the Koko Keywords API. The client handles caching to ensure very low latency.

Project description

Koko Keyword Python Client

A python client for the Koko Keywords API. The client handles caching to ensure very low latency.

Install

pip install koko_keywords

Usage

Set the KOKO_KEYWORDS_AUTH environment to the authentication string provided by Koko. To get an api key, complete our sign up form.

export KOKO_KEYWORDS_AUTH=username:password

Import the library

import koko_keywords

Then use the match function to check whether a query prompt matches a risky keyword

koko_keywords.match("sewerslide")

There is one optional param, filter.

Filter

Filter the keyword based on the taxonomy using a colon delimited list of “dimension=value” filters. Omitting a dimension does not filter by that dimension e.g.

koko_keywords.match("sewerslide", "category=eating,parenting:confidence=1,2")

This matches "sewerslide" against eating eating and parenting, with a confidence of 1 and 2 and any intensity (as intensity was omitted).

Performance

The underlying library is written in Rust and cross-compiled to the four major CPU targets. Regexes are cached based on the cache expiration headers (currently set to an hour). This ensures very low latency and overhead (< 1μs/req).

Error Handling

A RuntimeError will be raised with hints on how to resolve the issue. No exception handling should be necessary.

Logging

Minimal log messages are logged to STDERR

License

WWWWWW||WWWWWW
 W W W||W W W
      ||
    ( OO )__________
     /  |           \
    /o o|    MIT     \
    \___/||_||__||_|| *
         || ||  || ||
        _||_|| _||_||
       (__|__|(__|__|

(The MIT License)

Copyright (c) 2017 Koko AI Inc. us@kokocares.org

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

koko_keywords-0.3.0.tar.gz (8.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

koko_keywords-0.3.0-py3-none-any.whl (8.3 MB view details)

Uploaded Python 3

File details

Details for the file koko_keywords-0.3.0.tar.gz.

File metadata

  • Download URL: koko_keywords-0.3.0.tar.gz
  • Upload date:
  • Size: 8.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for koko_keywords-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1284c34ee409db1f676825573dbe13d6da87d8ac2d55a06fe0a5b1538bec8870
MD5 1ade29c07d7c606537679c7c3da82cb9
BLAKE2b-256 4771962c53e6e86f5e2a8002cf7a7a0dac3de4fd783a4384e59c7561569c7bba

See more details on using hashes here.

File details

Details for the file koko_keywords-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: koko_keywords-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for koko_keywords-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 11ef278fc43333aa0896252a6efcbaecc6131f245bdce495ba4c35ab73f53f95
MD5 a443cfd4cef482109ae173bc7f8ba314
BLAKE2b-256 cd900e6d58bd78266440a0d36ce89782f3f8e3a464310a8f3eecbdd9436819e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page