Skip to main content

Njinn CLI

Project description

Njinn CLI & Client

Installation

You can install the Njinn CLI from PyPI:

pip install njinn

The client is supported on Python 3.7 and above.

Njinn CLI Usage

  • Pack install

    njinn pack install <repository_url>

Use --help to see available options and defaults.

Njinn Client Usage

  • The client allows interacting with Njinn via its REST API.
  • To see available query string parameters, please refer to official Njinn Documentation.

Summary

api = NjinnAPI(host="https://njinn.io", token="*****")

# GET /workflows
api.workflows(limit=2)

# GET /workflows/1
api.workflows(1)

# POST /workflows
api.create(Workflow(title="Workflow 1"))

# PUT /workflows/1
api.workflows(1).save()

# DELETE /workflows/1
api.workflows(1).delete()

Get running executions

### GET /executions?workflow=1&state=RUNNING
executions = api.executions(workflow=1, state="RUNNING")

Add a label to execution

execution = api.executions(1)
execution.labels["my_label"] = "new"

# PATCH /executions/1 {...}
execution.save(fields="labels")

Cancel execution

# POST /executions/1/cancel {...}
api.executions(1).cancel()

Run Workflow

# POST /workflows/1/run {...}
execution = api.workflows(1).run(input={"variable_1": "value_1"})
print(execution.state)

Create webhook

# POST /hooks {...}
webhook = api.create(Webhook(name="W1", title="W1", workflow=1))

Disable webhook

webhook = api.hooks(1)
webhook.is_active = False

# PUT /hooks/1 {...}
webhook.save()

Delete webhook

# DELETE /hooks/1
api.webhooks(1).delete()

Create config

# POST /configs {...}
api.create(
  Config(
      name="W1",
      title="W1",
      values={"key_1": {"value": "value_1", "is_secret": False}}
  )
)

Update config

config = api.configs(1)
config.values["key_1"] = {"value": "value_1", "is_secret": False}

# PUT /configs/1 {...}
config.save()

Duplicate config

config = api.configs(1)

# POST /configs/1/duplicate {...}
duplicate = config.duplicate(name="new", title="New")
print(duplicate.id)

Get execution log

# GET /executions/1/log
log = api.executions(1).log()
print(log)

Get task execution log

# GET /executions/1/tasks/task_1/log
log = api.executions(1).tasks("task_1").log()
print(log)

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

njinn-0.3.2.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

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

njinn-0.3.2-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file njinn-0.3.2.tar.gz.

File metadata

  • Download URL: njinn-0.3.2.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.10

File hashes

Hashes for njinn-0.3.2.tar.gz
Algorithm Hash digest
SHA256 9b0036c47766d9e6f0ed66896389693ea85feec035cd026ec837a4fa96012e14
MD5 18067d681508ddc8108f6cb0087de205
BLAKE2b-256 a695f0fe23cd0cc68281e5f69c30e6478b59916d72729951b87f3fc11fbdf26d

See more details on using hashes here.

File details

Details for the file njinn-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: njinn-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.10

File hashes

Hashes for njinn-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e06ff3bfa8c9fb46807e4655ab2ea7e1aead85c8d1994d7b339b70b3c1e8a7f6
MD5 d3a9dafff2ee6e5844b13bb93741c515
BLAKE2b-256 7ad6d68c7b102beaa4124242b143687912f725091cc5112c228010f0a39847de

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