Package: open-gopro
Open GoPro Python SDKThis is a Python package that provides an
interface for the user to exercise the Open GoPro Bluetooth Low Energy (BLE) and Wi-Fi / USB HTTP API's as well as install command line interfaces to take photos, videos, and view video streams.Free software: MIT licenseDocumentation:View on Open GoProView onGithubDocumentationNote! This README is only an overview of the package.Complete documentation can be found onOpen GoProFeaturesTop-level GoPro class interface to use BLE, WiFi, and / or USBCross-platform (tested on MacOS Big Sur, Windows 10, and Ubuntu 20.04)BLE implemented usingbleakWi-Fi controller provided in the Open GoPro package (loosely based on theWireless LibrarySupports all commands, settings, and statuses from theOpen GoPro APIAsynciobasedAutomatically handles connection maintenance:manage camera ready / encodingperiodically sends keep alive signalsIncludes detailed logging for each moduleIncludes demo scripts installed as command-line applications to show BLE, WiFi, and USB functionality such as:Take a photoTake a videoConfigure and view a GoPro webcam streamGUI to send all commands and view the live / preview streamLog the batteryInstallationNote! This package requires Python >= 3.8 and < 3.12The minimal install to use the Open GoPro library and the CLI demos is:$pipinstallopen-goproTo also install the extra dependencies to run the GUI demos, do:$pipinstallopen-gopro[gui]UsageTo automatically connect to GoPro device via BLE and WiFI, set the preset, set video parameters, take a
video, and download all files:importasynciofromopen_goproimportWirelessGoPro,Paramsasyncdefmain():asyncwithWirelessGoPro()asgopro:awaitgopro.ble_setting.resolution.set(Params.Resolution.RES_4K)awaitgopro.ble_setting.fps.set(Params.FPS.FPS_30)awaitgopro.ble_command.set_shutter(shutter=Params.Toggle.ENABLE)awaitasyncio.sleep(2)# Record for 2 secondsawaitgopro.ble_command.set_shutter(shutter=Params.Toggle.DISABLE)# Download all of the files from the cameramedia_list=(awaitgopro.http_command.get_media_list()).data.filesforiteminmedia_list:awaitgopro.http_command.download_file(camera_file=item.filename)asyncio.run(main())And much more!DemosNote! These demos can be found onGithubDemos can be found in the installed package in the "demos" folder. They are installed as a CLI entrypoint
and can be run as shown below.Command Line Interface (CLI) DemosAll of these demos are CLI only and can thus be run with the minimal (non-GUI) install.Capture a photo and download it to your computer:$gopro-photoCapture a video and download it to your computer:$gopro-videoConnect to the GoPro and log battery consumption in to a .csv:$gopro-log-batteryConnect to the GoPro's Wi-Fi AP and maintain the connection:$gopro-wifiFor more information on each, try running with help as such:$gopro-photo--help

usage:gopro-photo[-h][-iIDENTIFIER][-lLOG][-oOUTPUT][-wWIFI_INTERFACE]ConnecttoaGoProcamera,takeaphoto,thendownloadit.

optionalarguments:-h,--helpshowthishelpmessageandexit-iIDENTIFIER,--identifierIDENTIFIERLast4digitsofGoProserialnumber,whichisthelast4digitsofthedefaultcameraSSID.Ifnotused,firstdiscoveredGoProwillbeconnectedto-lLOG,--logLOGLocationtostoredetailedlog-oOUTPUT,--outputOUTPUTWheretowritethephototo.Ifnotset,writeto'photo.jpg'-wWIFI_INTERFACE,--wifi_interfaceWIFI_INTERFACESystemWifiInterface.Ifnotset,firstdiscoveredinterfacewillbeused.GUI DemosThese demos require the additional GUI installation.Start the preview stream and view it:$gopro-preview-streamStart the live stream and view it:$gopro-live-stream