export
imerit_ango.sdk.SDK.
export(project_id, options, zip_file_path)
Export annotated assets together with labels and metadata. Users can customize the export process using an instance of the ExportOptions class and specify the output location.
Parameters
project_id: string
The unique identifier for the project. You can find the project ID in the user interface or retrieve it using the
list_projectsfunction.
options: ExportOptions, default ExportOptions()
An instance of the
ExportOptionsclass, which defines the configurations for the export operation.ExportOptions class
stage: List[str], default ['Complete']
A list of stage IDs to include in the export. Use the
get_projectfunction to retrieve IDs.Example:
["Complete", "a0000b0a-1111-0a00-a1a1-a111111111aa"]Note: Use an empty list to get all stages such as
stage = []Warning: The IDs of the Complete, Start and initial Label stages are identical to their names: "Complete", "Start" and "Label", respectively.
batches: List[str], default None
Filter export by specific batch IDs. Use the
get_batchesfunction to retrieve IDs.
export_format: ExportFormats, default ExportFormats.JSON
Format of the exported data.
Options:
ExportFormats.JSON
ExportFormats.NDJSON
export_type: ExportTypes, default ExportTypes.TASK
Type of export.
Options:
ExportTypes.TASK
ExportTypes.ISSUE
include_key_frames_only: bool, default False
If True, only exports key frames (for video assets).
sendEmail: bool, default False
If True, sends a notification email when export completes.
includeMetadata: bool, default True
If True, includes metadata with assets.
includeHistory: bool, default True
If True, includes annotation history.
doNotNotify: bool, default True
If True, suppresses system notifications.
updated_at: TimeFilter, default None
Filter assets by update timestamp. Updated At attribute displays the date and time when the task was last updated, this includes the most recent submission, save, or skip.
created_at: TimeFilter, default None
Filter assets by creation timestamp. Created At attribute shows the date and time when the asset was imported into Ango Hub.
TimeFilter class
from_date: datetime, default None
Start date for filtering.
to_date: datetime, default None
End date for filtering.
zip_file_path: string, optional, default None
If specified, exports are downloaded directly as a .zip file instead of being returned as a Python object. This avoids server-side unzipping and speeds up export.
Example:
"/Users/username/Downloads/my_export.zip"
Returns:
output: list
A list containing the result of the export operation.
The project must contain annotated assets, and the selected filters should include them; otherwise, the export will return empty.
Example
Export all assets in the Complete stage:
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')
ango_sdk = SDK(api_key)
export_data = ango_sdk.export(project_id)curl -X GET "https://imeritapi.ango.ai/v2/export \
?sendEmail=false \
&includeMetadata=true \
&includeHistory=true \
&doNotNotify=true \
&format=json \
&type=task \
&includeOnlyKeyFrames=false \
&includeIdleBlurDurations=false \
&stage=[\"Complete\"] \
&project=$PROJECT_ID" \
-H "apikey: $ANGO_API_KEY"Export assets filtered by created and updated time:
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from datetime import datetime, timedelta
from imerit_ango.models.enums import ExportFormats
from imerit_ango.models.export_options import ExportOptions, TimeFilter
load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')
ango_sdk = SDK(api_key)
export_options = ExportOptions(export_format=ExportFormats.JSON,
updated_at=TimeFilter(from_date=datetime.now() - timedelta(days=7), to_date=datetime.now()),
created_at=TimeFilter(from_date=datetime.now() - timedelta(days=30), to_date=datetime.now()),
stage=["Complete"])
export_data = ango_sdk.export(project_id, options=export_options)curl -X GET "https://imeritapi.ango.ai/v2/export \
?sendEmail=false \
&includeMetadata=true \
&includeHistory=true \
&doNotNotify=true \
&format=json \
&type=task \
&includeOnlyKeyFrames=false \
&includeIdleBlurDurations=false \
&stage=[\"Complete\"] \
&updatedAt={\"$gt\":\"2020-08-19T07:37:15.000000Z\",\"$lt\":\"2020-08-26T07:37:15.000000Z\"} \
&createdAt={\"$gt\":\"2020-07-27T07:37:15.000000Z\",\"$lt\":\"2020-08-26T07:37:15.000000Z\"} \
&project=$PROJECT_ID" \
-H "apikey: $ANGO_API_KEY"Export assets in NDJSON format:
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from imerit_ango.models.enums import ExportFormats
from imerit_ango.models.export_options import ExportOptions
load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')
ango_sdk = SDK(api_key)
export_options = ExportOptions(export_format=ExportFormats.NDJSON, stage=["Complete"])
export_generator, num_assets = ango_sdk.export(project_id, options=export_options)
print(f"Number of exported assets: {num_assets}")
for asset in export_generator:
print(asset.get("externalId", ""))curl -X GET \
"https://imeritapi.ango.ai/v2/export \
?sendEmail=false \
&includeMetadata=true \
&includeHistory=true \
&doNotNotify=true \
&format=ndjson \
&type=task \
&includeOnlyKeyFrames=false \
&includeIdleBlurDurations=false \
&stage=[\"Complete\"] \
&project=&PROJECT_ID" \
-H "apikey: &ANGO_API_KEY"Last updated