A Python package for interacting with ORBL on-premise API
Project description
Python API client for ORBL on-premise API
This library is mirror of official ORBL on-premise API in terms of methods and interfaces.
For your convenience, you can make API calls using sync or async (asyncio) interface.
Installation
pip install orbl_onpremise
Note that it is always recommended pinning version of your installed packages.
Usage example (sync)
An example of how to create an origin:
from orbl_onpremise import Client
if __name__ == '__main__':
# api_token is just str with your API token
api_token = "abcd012345"
# Now create instance of Client. There should be only one per process.
client = Client(base_url="http://localhost:8080", api_token=api_token)
# Issue API request to create an origin
client.origins.create(name="test_name")
Now that we have our origin created, we can create profile inside that origin:
from orbl_onpremise import Client
def create_profiles_example(client: Client):
origin_id = 1 # you can inspect response from `client.origins.create`
with open("image.png", "rb") as f:
response = client.profiles.create(
image=f,
origin_id=origin_id
)
print("Profiles Create Response:\n", response.json(), flush=True)
if __name__ == '__main__':
# api_token is just str with your API token
api_token = "abcd012345"
# Now create instance of Client. There should be only one per process.
client = Client(base_url="http://localhost:8080", api_token=api_token)
# Issue API request to create a profile
create_profiles_example(client)
Now that we have our origin & profile created, we can search for profile:
from orbl_onpremise import Client
def search_profiles_example(client: Client):
with open("image.png", "rb") as f:
response = client.profiles.search(
image=f,
identify_asm=True
)
print("Profiles Search Response:\n", response.json(), flush=True)
if __name__ == '__main__':
# api_token is just str with your API token
api_token = "abcd012345"
# Now create instance of Client. There should be only one per process.
client = Client(base_url="http://localhost:8080", api_token=api_token)
# Issue API request to search profiles
search_profiles_example(client)
For more examples and usage, please refer to the docs.
Development setup
To install all the development requirements:
pip install --upgrade pip
pip install poetry
poetry install --no-root
To run linters & test suite:
./scripts/test.sh
How to release
- Update version in:
CHANGELOG.md
__init__.py
pyproject.toml
- Lock deps to update version in poetry:
poetry lock
- Get API Token from account settings in PyPI
poetry config pypi-token.pypi YOUR_API_TOKEN
poetry build
poetry publish
Release History
- 0.1.1
- Fixed types of custom Enum classes and in corresponding methods
- 0.1.0
- Initial version of package
License
Distributed under the MIT license. See LICENSE
for more information.
Contributing
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request
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
Built Distribution
File details
Details for the file orbl_onpremise-0.1.1.tar.gz
.
File metadata
- Download URL: orbl_onpremise-0.1.1.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.9.6 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71238728699c298de0d433ef5dd1ba6e834c229bed2843ecd0990b224a1bb47d |
|
MD5 | e6b22e5dad2e2253384b0bb89e72ca4d |
|
BLAKE2b-256 | cad1ca20be1d1acd9b1d121111d0d006a0fae71e5e81daa0c4d660181e21e6f8 |
File details
Details for the file orbl_onpremise-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: orbl_onpremise-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.9.6 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45316c17076163207fdc1c33a2f53de1cf2200e6d9221f1574d404fd3d0b9d82 |
|
MD5 | 97ffbc6e21d55f0bfbb6609e469e86b2 |
|
BLAKE2b-256 | 4e5647a06ba3aff25223ff496a408c8e331a4bf256c55b4be37b8dbee99e3f3c |