Instead of using direct URL calls to the EditShare FLOW api,
EditShare provides a Python package which uses classes to wrap this api.
Each service is represented as a class within the FlowAPI module.
The editshare-flow-api package is released in our https://artifacts.editshare.com/artifactory/editshare-pypi-public PyPi repository. Versions can be found in
https://artifacts.editshare.com/artifactory/editshare-pypi-public/editshare-flow-api/
You can install it using
pip install --extra-index-url https://artifacts.editshare.com/artifactory/api/pypi/editshare-pypi-public/simple editshare-flow-api~=2024.1
or add something like this to your requirements.txt file:
--extra-index-url https://artifacts.editshare.com/artifactory/api/pypi/editshare-pypi-public/simple
and to select a version use one of
# specific version
editshare-flow-api==2024.1.0.0
# latest 2024.1 version
editshare-flow-api~=2024.1
# latest 2024.1.2 version
editshare-flow-api~=2024.1.2
Note that .dev0 versions will not be selected by this, since they are considered 'earlier' compared to other matching versions.
After installation you can import and use FlowAPI:
import os
import FlowAPI
metadata_api = FlowAPI.Metadata.create_gateway_instance(
os.environ["FLOW_USER"], os.environ["FLOW_PASSWORD"], os.environ["FLOW_HOST"]
)
print("metadata_api.version is", metadata_api.version())
clip_data = metadata_api.get_clip(157864)
new_comment = {"comment": "hello from FlowAPI"}
print("Updating comment on clip...")
metadata_api.update_asset(clip_data["asset"]["asset_id"], new_comment)
print("Return code is", metadata_api.last_return_code())
print("Response is", metadata_api.last_response())