Download the media file that will be display on a material

The file extension will be in .mp4

from smart_prospective_api import SPApi, APIError

PUBLIC_KEY = "pub_XXXXX"
PRIVATE_KEY = "sec_XXXXX"


try:
    # Setup the API credencial (do not perform any request at this moment)
    # Note: The public key starts by "pub_" & The secret key starts by "sec_"
    sp_api = SPApi(PUBLIC_KEY, PRIVATE_KEY)

    media = sp_api.get_medias()[0]
    # DOWNLOAD FINAL FILE (according to a specific material) (If media has just been created, need to wait or an APIError will be raised)
    # Download the media file that will be display on a material (all category except 'web')
    media_filepath = sp_api.download_final_media(media["code"], sp_api.get_materials()[0]["code"], filename="final-file")
    # Note: the filename can be given (no extension because will be auto set) (the filename can include the filepath which will be created if not yet)
    print(f"Download done for final media file: {media['name']} into: {media_filepath}")

    sp_api.logout()  # Logout the account, more safe to use it, to avoid potential attacks
except APIError as e:
    print(f"Failure using the Smart Prospective API: {e}")
curl --location --request POST 'https://app.smartprospective.com/api/medias/download/final' \
--form 'token="XXXXXX"' \
--form 'media_code="MediaCodeX"' --ouput file.mp4

Works for all media category except for 'web'
If media has just been created, need to wait for the converted file to be generated by the server