Skip to main content

Python library for calling Slyce API.

Project description

Slyce

Client for calling Slyce API.

Quickstart

import asyncio
import os

from slyce import SlyceClient
from slyce.exception import SlyceError

os.environ['SLYCE_APPLICATION_CREDENTIALS'] = '/some/path/to/creds'

FINGERPRINT= 'UNIQUE_USER_IDENTIFIER'  # Optional
IMAGE_PATH = '/some/path/to/image'
WORKFLOW_ID = 'WORKFLOW_ID'

async def main(loop):
    with SlyceClient(fingerprint=FINGERPRINT) as slyce:
        try:
            image_id = await slyce.upload_image(IMAGE_PATH)
            res = await slyce.execute_workflow(WORKFLOW_ID, image_id=image_id)
            if res.get('data'):
                data = res['data']
                print(f"Type: {data['type']}")
                print(f"Operation: {data['operation']}")
                if data.get('results'):
                    print(f"First Result: {json.dumps(data['results'][0], indent=2)}")
        except SlyceError as e:
            print(e)


loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))

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

slyce-0.2.0.tar.gz (11.6 kB view details)

Uploaded Source

File details

Details for the file slyce-0.2.0.tar.gz.

File metadata

  • Download URL: slyce-0.2.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.5

File hashes

Hashes for slyce-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7c99ac0152e2d54339ac5538e299f6ccf46d8cb1925f07975c7e2f322a2b765d
MD5 9258051a42211d3fedb3741d15c5f2cf
BLAKE2b-256 3674edad21057c21ce033af55bf811c0d28f146fffa4454c748337d02b4e165e

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