Skip to main content

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

Release History

  • 0.1.0
    • Initial version of package

License

Distributed under the MIT license. See LICENSE for more information.

Contributing

  1. Fork it (https://github.com/yourname/yourproject/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

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

orbl_onpremise-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

orbl_onpremise-0.1.0-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file orbl_onpremise-0.1.0.tar.gz.

File metadata

  • Download URL: orbl_onpremise-0.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.9.6 Darwin/22.3.0

File hashes

Hashes for orbl_onpremise-0.1.0.tar.gz
Algorithm Hash digest
SHA256 267093b9a429250cf17be1d7202592c52ae1ef1b16b46f339543740a88051a50
MD5 0b99fdae400b499d40b918881d3ed392
BLAKE2b-256 5237edea8fe05d1ce7d9290312c43d7d00f35196b6d212657bbfa89041a47b96

See more details on using hashes here.

File details

Details for the file orbl_onpremise-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: orbl_onpremise-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.1 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

Hashes for orbl_onpremise-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8852f45a82070789c04230b55d971f7a8f1ebd1c8682b9bd82e00e52485f8f3d
MD5 d946151b48ebad9daaac2996eceeeebb
BLAKE2b-256 345f6a4d052bc82d7d343c1047d4b3f5fdeb338eb1be4c46b6384fba03ac3641

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page