Enable a media
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]
# ENABLE
if sp_api.enable_media(media["code"]): # Enable the just created Media
print(f"The media: {media['name']} has been enable")
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/enable' \
--form 'token="XXXXXX"' \
--form 'media_code="MediaCodeX"'