Official client for InUse
Project description
pyinuse
pyinuse
is the official Python client for InUse API.
It provides the following main API methods:
- list
- create
- update
- partial_update
- retrieve
- destroy
For main end points such as:
- manufacturers
- machine_models
- machines
- producers
- sites
- lines
- machines
- properties
- multispans
- csvs
- posts
- triggers
- synoptics
- files
- agents
- groups
- favorites
- notifications
- alerts
- sandboxes
Please refer to InUse API documentation (Accessible from the Studio) for more details.
API versioning
The actual API version is the internal API (not versioned) and is subject to changes. A versioned public API will be created in a later stage and used in this python client.
Example of usage
# Library used to type a password in a secured way.
import getpass
# Client library for the InUse API.
from pyinuse import InUse
# Library for logging
import logging
logging.basicConfig(format="%(asctime)s, %(name)s, %(levelname)s, %(message)s", level=logging.INFO)
manufacturer_code="mycompany" # replace with your manufacturer code
# login
inuse = InUse(base_url=f"https://studio.{manufacturer_code}.productinuse.com")
inuse.login(input("Username? "), getpass.getpass("Password? "))
# get my manufacturer
# each endpoint is accessible by its name as an attribute of InUse instance
manufacturer = inuse.manufacturers.list()[0]
# create a new machine_model
machine_model = inuse.machine_models.update_or_create(
params={"manufacturer": manufacturer["pk"], "code": "my-machine-model"},
data={
"manufacturer": manufacturer["pk"],
"code": "my-machine-model",
"name": "my machine model",
},
)
# logout once you're done
inuse.logout()
History
0.1.2
- Add session headers
0.1.1
- Handle response error
0.1.0
- First version based on the internal API
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyinuse-0.1.2.tar.gz
(5.2 kB
view details)
Built Distribution
File details
Details for the file pyinuse-0.1.2.tar.gz
.
File metadata
- Download URL: pyinuse-0.1.2.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28765b47d9a0c57a96d96b4f49670f9e637e5b2973bff2f9a78a31d420216699 |
|
MD5 | a8063e02c6dbdd27fd86c7eff4d5e998 |
|
BLAKE2b-256 | 3a29b749d41bc0fcc7f79a847eac163aa74537c00dcc867a0a83900c8642f779 |
File details
Details for the file pyinuse-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: pyinuse-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c583c4127b34c8a6be60724da73c52469be073bc24e1da2044b6536ad704f2d |
|
MD5 | c120c12a668ef4a645dc5cda471f6c7b |
|
BLAKE2b-256 | c35a3f76818ebf4342a8622298d74502d6ed286f1e99d64a7efe90c3e9b2d029 |