Skip to main content

Simple REST-client for jinjamator

Project description

simple_jinjamator is a simplified REST client for jinjamator

Features

simple_catalyst_center has following features:
  • manage login

  • download files

  • upload files

  • run tasks with environment support and basic enforcement of required parameters

  • wait for job results

  • check job status

  • CRUD interface for all possible API URLs

Installation

Install by running:

pip3 install simple_jinjamator

Examples

run a task and download all generated files

import os
import sys
from simple_jinjamator import JinjamatorClient
import logging
from getpass import getpass

base_url = input("Please Enter Jinjamator URL: ") or "http://localhost:5000"
username = input("Please Enter Jinjamator username: ") or "root"
password = getpass("Please Enter Jinjamator password: ") or "<not set>"

URL=f"{base_url}/api"

jm_client = JinjamatorClient(URL, ssl_verify=False)
print("login to jinjamator with username and password using the local aaa povider")
jm_client.login(username, password, "local")
api = jm_client.api

print("start job in environment some/env with the parameter command and get the job id")

job_id=jm_client.run("/tasks/jinjamator101/discover_cisco_device",environment="some/env",command="show interface status")

print("poll job status and wait for success or failure (default timeout is 300s, default pollrate=10s) ")
jm_client.wait_for_job(job_id)

print("download all generated files to /tmp")
jm_client.download_job_files(job_id,"/tmp")

for all options have a look at the JinjamatorClient class in simple_jinjamator/__init__.py

Contribute

Roadmap

Selected Roadmap items:
  • add more documentation

  • add some more examples

For documentation please refer to https://simple_jinjamator.readthedocs.io/en/latest/

License

This project is licensed under the Apache License Version 2.0

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

simple_jinjamator-0.1.1-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file simple_jinjamator-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_jinjamator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f12c7bc0d79752df0d83caaeeebf0680d9d399a5f8b01f5e3a24815dc2bf892c
MD5 20a33d63f807af11907ed44578dd3d74
BLAKE2b-256 23abe04e907f5af2d0f3d319393e55afa598dc9b11d52c4b7977220d4f05637e

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