Skip to main content

python-gopro

PyPI Tests License: MIT

Async, local client for GoPro cameras: HTTPS over Camera on the Home Network (COHN) and BLE. It was built by reverse engineering a GoPro MAX2 (firmware H24.02.01.34.00) and its Linux userland, and it is the communication layer of the GoPro Home Assistant integration.

  • No cloud, no USB cable: the camera joins your Wi-Fi once (provisioned over BLE) and is reachable at https://<ip> with basic auth and its own root CA.
  • Self-describing: settings, options, statuses, modes, commands and option filters are read from the camera itself (GET /gp/gpControl), so HERO12/HERO13/MAX2 and future firmwares work without code changes.
  • Legacy /gp/gpControl/command/* routes recovered from the firmware (locate, sleep, tag moment...).
  • BLE: pairing, hardware info, statuses, settings, shutter, presets, date/time, Wi-Fi scan + provisioning, COHN certificate/status, keep-alive and wake.

Install

pip install python-gopro          # HTTP only
pip install "python-gopro[ble]"   # + BLE (bleak)

Quick start

import asyncio
from pygopro import GoProBle, GoProHttp

async def main():
    # 1) one-time: put the camera in pairing mode (Preferences > Connections > Connect Device)
    async with GoProBle("GoPro 8832") as ble:
        creds = await ble.provision_cohn("MyWiFi", "wifi-password")

    # 2) from now on, plain HTTPS on the home network
    async with GoProHttp(creds.host, username=creds.username, password=creds.password,
                         certificate=creds.certificate) as cam:
        print(await cam.get_info())
        state = await cam.get_state()
        schema = await cam.get_schema()          # every setting/status with names and options
        for sid, value in state.settings.items():
            s = schema.settings.get(sid)
            if s:
                print(s.name, s.option_names.get(value))
        await cam.shutter(True)                  # start recording
        await cam.shutter(False)
        print(await cam.get_media_list())

asyncio.run(main())

CLI:

pygopro ble-scan
pygopro provision --ssid MyWiFi --wifi-password secret --out gopro.json
pygopro --creds gopro.json state
pygopro --creds gopro.json locate on

Things learned the hard way

  • Never call /gopro/camera/control/wired_usb. On the MAX2 it hung and left every /gopro/* route answering 503 "Unable to establish comminucation with settings controller". The power button only suspends the camera, so the state survives until the battery is removed. The client refuses that path and raises GoProControllerUnavailableError for the 503.
  • Over BLE, messages must fit in one write; continuation packets written with response are rejected (GATT 0xD1). Protobuf queries (0xF5) go to the query characteristic.
  • Without valid basic auth the COHN server closes the socket without an answer.

See docs/PROTOCOL.md for the full write-up.

License

MIT. Not affiliated with GoPro, Inc. "GoPro" is a trademark of GoPro, Inc.

Metadata

Release files for python-gopro 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-gopro 0.1.0
File Size Uploaded Provenance Actions
python_gopro-0.1.0.tar.gz 28.0 kB Without provenance Details for python_gopro-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-gopro 0.1.0
File Interpreter ABI Platform Actions
python_gopro-0.1.0-py3-none-any.whl Python 3 none any Details for python_gopro-0.1.0-py3-none-any.whl

Total release size: 55.6 kB

Release files / python_gopro-0.1.0.tar.gz

Download URL python_gopro-0.1.0.tar.gz
Size 28.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8ddcd3b6d3b2afa8abd87e524822f7daa6ef3218d00066d78b5bd077f8ae87fe
BLAKE2b-256 checksum
How to use checksums
16a100974e539706e1f06c3e1054b8684dea2c3f718372dfc4c344bafbf29e01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release files / python_gopro-0.1.0-py3-none-any.whl

Download URL python_gopro-0.1.0-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1edc8c112aa7c37526979e9589243bbf47580ce3750b676c27298a5644eb9ce3
BLAKE2b-256 checksum
How to use checksums
327f3071d7ed1de5f22e53850d67fb6d6e5cd2d3d7d85e4e8ea9a57df9654f55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Security for python-gopro 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page