Skip to main content

Sorna API Client Library

Project description

Travis Build Status AppVeyor Build Status Code Coverage PyPI

The API client library for Sorna

Usage

Grab your keypair from cloud.sorna.io or your cluster admin.

export SORNA_ACCESS_KEY=...
export SORNA_SECRET_KEY=...

# optional (for local clusters)
export SORNA_ENDPOINT="https://my-precious-cluster/"

Synchronous API

from sorna.kernel import Kernel

kern = Kernel.get_or_create('lua5', client_token='abc')
result = kern.execute('print("hello world")', mode='query')
print(result['console'])
kern.destroy()

Asynchronous API

import asyncio
from sorna.asyncio.kernel import AsyncKernel

async def main():
    kern = await AsyncKernel.get_or_create('lua5', client_token='abc')
    result = await kern.execute('print("hello world")', mode='query')
    print(result['console'])
    await kern.destroy()

loop = asyncio.get_event_loop()
try:
    loop.run_until_complete(main())
finally:
    loop.close()

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

sorna-client-0.9.2.tar.gz (8.4 kB view hashes)

Uploaded Source

Built Distribution

sorna_client-0.9.2-py3-none-any.whl (11.0 kB view hashes)

Uploaded Python 3

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