Skip to main content

A simple API client for code execution

Project description

InstaVM Client

A Python client library for interacting with a simple API.

Installation

You can install the package using pip: pip install instavm

Usage

Basic Usage

from instavm import InstaVM, ExecutionError, NetworkError

# Create client with automatic session management
client = InstaVM(api_key='your_api_key')

try:
    # Execute a command
    result = client.execute("print(100**100)")
    print(result)

    # Get usage info for the session
    usage = client.get_usage()
    print(usage)

except ExecutionError as e:
    print(f"Code execution failed: {e}")
except NetworkError as e:
    print(f"Network issue: {e}")
finally:
    client.close_session()

Context Manager (Recommended)

from instavm import InstaVM

# Automatic session cleanup
with InstaVM(api_key='your_api_key') as client:
    result = client.execute("print('Hello from InstaVM!')")
    print(result)
    # Session automatically closed

Streaming Execution

from instavm import InstaVM

with InstaVM(api_key='your_api_key') as client:
    # Real-time output streaming
    for output in client.execute_streaming("pip install matplotlib && python -c 'import matplotlib; print(\"Success!\")'"):
        print(f"Output: {output}")

Error Handling

from instavm import InstaVM, AuthenticationError, RateLimitError, SessionError

try:
    client = InstaVM(api_key='invalid_key')
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Rate limit exceeded - try again later")
except SessionError as e:
    print(f"Session error: {e}")

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

instavm-0.1.5.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

instavm-0.1.5-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file instavm-0.1.5.tar.gz.

File metadata

  • Download URL: instavm-0.1.5.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for instavm-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6fcbd076ce59f576d58ecf57e4f3e9b61f1114c879cea2e171c34091db0b54a1
MD5 be0d544c40772c5710c7e0d0d61ba56f
BLAKE2b-256 44c5567bb0e665fa9bd6c6aa4929baa555a623dc5d3360808b6804ea5a3334df

See more details on using hashes here.

File details

Details for the file instavm-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: instavm-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for instavm-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ba5abd8bbd273f2c9c05ea175c8ed9f00e138a193581c55020140fb78fbdcbda
MD5 cc23d0f53af9175f80ced1d7d9ad22ec
BLAKE2b-256 65d95f0683c720c2d65822899dc07ebf4695429f1c529cec88990c1d552fa305

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