Skip to main content

Python client for the Alpha Camera REST API — control Sony cameras via REST.

Project description

alpha-sdk-client

Python client for the Alpha Camera REST API.

Install (local development)

pip install -e .

Run the notebook example

If you want the standalone public example repo instead of the in-repo helper, use:

Start the camera server first, then from sdks/python/ install the SDK in editable mode:

cd sdks/python
pip install -e .

You can sanity-check the example script directly:

python examples/notebook_data_collection.py

That file is primarily intended to be imported from Jupyter or another notebook environment.

If you want to use it in Jupyter:

cd sdks/python
python -m pip install jupyter
jupyter notebook

Then in a notebook cell:

import sys
from pathlib import Path

sys.path.append(str(Path("examples").resolve()))

from alpha_sdk_client import AlphaSDKClient
from notebook_data_collection import (
    collect_property_rows,
    connect_first_camera,
    enable_live_view,
    fetch_live_view_frame,
    save_live_view_frame,
)

client = AlphaSDKClient(base_url="http://localhost:8080")
camera = connect_first_camera(client, mode="remote")
rows = collect_property_rows(client, camera.id, count=5, interval_s=1.0)

Usage

from alpha_sdk_client import AlphaSDKClient

client = AlphaSDKClient(base_url="http://localhost:8080")
cameras = client.cameras.list()
print(cameras.cameras)

Async

from alpha_sdk_client import AsyncAlphaSDKClient

client = AsyncAlphaSDKClient(base_url="http://localhost:8080")
cameras = await client.cameras.list()

Notebook / data collection example

For a minimal Jupyter-friendly workflow, use:

  • sdks/python/examples/notebook_data_collection.py

Standalone public example repo:

It covers the common data-science path:

  • discover and connect to the first camera
  • collect repeated property snapshots into row dictionaries
  • trigger AF capture
  • fetch and save a live-view JPEG frame
  • preview SD card files in remote-transfer mode

Typical notebook usage:

from alpha_sdk_client import AlphaSDKClient
from notebook_data_collection import (
    collect_property_rows,
    connect_first_camera,
    enable_live_view,
    fetch_live_view_frame,
    save_live_view_frame,
)

client = AlphaSDKClient(base_url="http://localhost:8080")
camera = connect_first_camera(client, mode="remote")

rows = collect_property_rows(client, camera.id, count=5, interval_s=1.0)

enable_live_view(client, camera.id)
frame = fetch_live_view_frame(client, camera.id)
save_live_view_frame(frame, "frame.jpg")

If you want a pandas DataFrame, the helper already returns plain row dictionaries:

import pandas as pd

df = pd.DataFrame(rows)
df.head()

Recipes — SSE, live view, server lifecycle, discovery

This SDK covers every REST endpoint. For the patterns that aren't REST (real-time events, frame polling, spawning the server) use the copy-paste recipes on crsdk.app:

Pattern Recipe
Real-time events (SSE) SSE events
Live view frame polling Live view polling
Server subprocess lifecycle Server subprocess
Camera discovery / hot-plug Discovery + reconnect
Retry with backoff Retry + backoff

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

alpha_sdk_client-0.3.2.tar.gz (60.8 kB view details)

Uploaded Source

Built Distribution

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

alpha_sdk_client-0.3.2-py3-none-any.whl (114.0 kB view details)

Uploaded Python 3

File details

Details for the file alpha_sdk_client-0.3.2.tar.gz.

File metadata

  • Download URL: alpha_sdk_client-0.3.2.tar.gz
  • Upload date:
  • Size: 60.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for alpha_sdk_client-0.3.2.tar.gz
Algorithm Hash digest
SHA256 b514689e2dfe3e91bff7bd2e0d3e3e219b45409f3d2f761e422d47e77a9cfcd0
MD5 92909373d57229b90f346ec1d0654e8e
BLAKE2b-256 6818ccb28ff7d82b796343279396a0e30e680d59ea80d6e33f920475bb64477d

See more details on using hashes here.

File details

Details for the file alpha_sdk_client-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for alpha_sdk_client-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8011420dff6cb566acacf5e324256d1e1e3b7a845f911151f1bb64de61ff05d3
MD5 f1b749282202ec2bf5f82b39acd610c8
BLAKE2b-256 acc9e46e868272b5654cedacfe37ada72d6a63162d9a191ceb57fd8a60eb9e6f

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