KnackHQ
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_IDKNACKHQ_API_KEYKNACKHQ_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_idpagerows_per_pagesort_fieldsort_orderfilters
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
Metadata
Release files for knackhq 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| knackhq-0.3.0.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| knackhq-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.5 kB
Release files / knackhq-0.3.0.tar.gz
| Download URL | knackhq-0.3.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16f560eb86bd7a40acf3aa440eabf982ab71c9c0c9f9b3c34b7e94a0fed1a09c
|
|
BLAKE2b-256 checksum How to use checksums |
0e2148e2bb79e667eb7b1b3d37af2fa31eeeb4281dda2851a901d36238cbbc09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Release files / knackhq-0.3.0-py3-none-any.whl
| Download URL | knackhq-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cab96fdb565e68c2a6cbdaa9067d2a74531117b32ae1ee96b356ff53235dfb3c
|
|
BLAKE2b-256 checksum How to use checksums |
09181e5a5914565c060b743ee852e272abe8daf1514150473b5debdc04d20032
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|