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.1.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.1-py3-none-any.whl (114.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: alpha_sdk_client-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 ec35f830574399c70ae2cc94369e46e2a79534ca666ceb373f3d47b9d7feb172
MD5 c5fe9f024ee48cd66e06450229b93af9
BLAKE2b-256 522c072d5bb5d03b7a38a4413709187de6bcd69b0916f739f4a9e940121bc4b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alpha_sdk_client-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e437ba62c0f40f7b5bdf7045f1483e0e75da8e41dfd36f5711a675db7b22af89
MD5 2f4e50b68924c3b81bce6d83ec424efd
BLAKE2b-256 b560e0f77d652fbb28d26e7f4b5667ed8820e9bddc8e764eab162a276614a9b8

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