Skip to main content

KnackHQ API Client

Project description

KnackHQ

pypi python pytest coverage maintainability

Python wrapper for KnackHQ API

Installation

pip install knackhq

Connect to KnackHQ

Create a KnackApp instance to begin interacting with KnackHQ. Supply an app ID, an API key, and an optional API endpoint URL to the client:

import knackhq

app = knackhq.KnackApp('<app_id>', '<api_key>')

Alternatively, set these values in your environment with:

  • KNACKHQ_APP_ID
  • KNACKHQ_API_KEY
  • KNACKHQ_ENDPOINT (optional)
app = knackhq.KnackApp()

Reading from KnackHQ

Raw requests

You may wish to send a raw request response from the KnackHQ API:

app.request('GET', 'objects/object_1/records')  # or,
app.request('GET', 'objects', 'object_1', 'records')

Getting Objects

Use dictionary syntax to get objects by name or key:

obj = app['object_1']  # or,
obj = app['MyObject']

Access object metadata using dictionary syntax:

obj['name']
obj['key']
obj['fields']

Getting Records

Use the get_records() method to iterate over records in an object:

for record in obj.get_records():
    print(record)

Supply arguments to get_records() to filter records. Options include:

  • record_id
  • page
  • rows_per_page
  • sort_field
  • sort_order
  • filters

Use filters to refine your search:

filters = [
    {
        field: 'field_1',
        operator: 'is',
        value: 'test'
    }, {
        field: 'field_2',
        operator: 'is not blank'
    }
]

for record in obj.get_records(filters=filters):
    print(record)

If you know the ID of the record, use get_record() to return a single record:

record = obj.get_record('1234567890ABCDEF')

Writing Records

TODO

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

knackhq-0.2.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

knackhq-0.2.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file knackhq-0.2.2.tar.gz.

File metadata

  • Download URL: knackhq-0.2.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.1

File hashes

Hashes for knackhq-0.2.2.tar.gz
Algorithm Hash digest
SHA256 dd3e06e0fd8b26ae9b6311dfd8fecdb481753928953b72452d5faa5b42c68f18
MD5 230aea114ada855ee1ec6f550df0679a
BLAKE2b-256 b3ef4caf549eef50c94bf6b4cc7a3e16da4fb11665622adfd214be1830233ee3

See more details on using hashes here.

File details

Details for the file knackhq-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: knackhq-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.1

File hashes

Hashes for knackhq-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e9cf11078b8c588703ecdf7bd8aac527917ef801c3bfe86e9a45b0566035279a
MD5 35bf89514bcd2daad051bc68b52c09cf
BLAKE2b-256 b278d0739636daa30c5b3d891ceef169aac1c14a30d45ecd4434b7c0f5166c71

See more details on using hashes here.

Supported by

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