Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions examples/border.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
from shotstack_sdk.model.edit import Edit

if __name__ == "__main__":
configuration = shotstack.Configuration(
host = "https://api.shotstack.io/stage"
)
host = "https://api.shotstack.io/stage"

if os.getenv("SHOTSTACK_HOST") is not None:
host = os.getenv("SHOTSTACK_HOST")

configuration = shotstack.Configuration(host = host)

if os.getenv("SHOTSTACK_KEY") is None:
sys.exit("API Key is required. Set using: export SHOTSTACK_KEY=your_key_here")
Expand Down Expand Up @@ -60,11 +63,14 @@
output = output
)

api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
try:
api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
except Exception as e:
print(f"Unable to resolve API call: {e}")
28 changes: 17 additions & 11 deletions examples/destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
from shotstack_sdk.model.shotstack_destination import ShotstackDestination

if __name__ == "__main__":
configuration = shotstack.Configuration(
host = "https://api.shotstack.io/stage"
)
host = "https://api.shotstack.io/stage"

if os.getenv("SHOTSTACK_HOST") is not None:
host = os.getenv("SHOTSTACK_HOST")

configuration = shotstack.Configuration(host = host)

if os.getenv("SHOTSTACK_KEY") is None:
sys.exit("API Key is required. Set using: export SHOTSTACK_KEY=your_key_here")
Expand Down Expand Up @@ -75,11 +78,14 @@
output = output
)

api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
try:
api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
except Exception as e:
print(f"Unable to resolve API call: {e}")
28 changes: 17 additions & 11 deletions examples/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
from shotstack_sdk.model.title_asset import TitleAsset

if __name__ == "__main__":
configuration = shotstack.Configuration(
host = "https://api.shotstack.io/stage"
)
host = "https://api.shotstack.io/stage"

if os.getenv("SHOTSTACK_HOST") is not None:
host = os.getenv("SHOTSTACK_HOST")

configuration = shotstack.Configuration(host = host)

if os.getenv("SHOTSTACK_KEY") is None:
sys.exit("API Key is required. Set using: export SHOTSTACK_KEY=your_key_here")
Expand Down Expand Up @@ -116,11 +119,14 @@
output = output
)

api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
try:
api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
except Exception as e:
print(f"Unable to resolve API call: {e}")
28 changes: 17 additions & 11 deletions examples/gif.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
from shotstack_sdk.model.shotstack_destination import ShotstackDestination

if __name__ == "__main__":
configuration = shotstack.Configuration(
host = "https://api.shotstack.io/stage"
)
host = "https://api.shotstack.io/stage"

if os.getenv("SHOTSTACK_HOST") is not None:
host = os.getenv("SHOTSTACK_HOST")

configuration = shotstack.Configuration(host = host)

if os.getenv("SHOTSTACK_KEY") is None:
sys.exit("API Key is required. Set using: export SHOTSTACK_KEY=your_key_here")
Expand Down Expand Up @@ -72,11 +75,14 @@
output = output
)

api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
try:
api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
except Exception as e:
print(f"Unable to resolve API call: {e}")
28 changes: 17 additions & 11 deletions examples/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
from shotstack_sdk.model.edit import Edit

if __name__ == "__main__":
configuration = shotstack.Configuration(
host = "https://api.shotstack.io/stage"
)
host = "https://api.shotstack.io/stage"

if os.getenv("SHOTSTACK_HOST") is not None:
host = os.getenv("SHOTSTACK_HOST")

configuration = shotstack.Configuration(host = host)

if os.getenv('SHOTSTACK_KEY') is None:
sys.exit("API Key is required. Set using: export SHOTSTACK_KEY=your_key_here")
Expand Down Expand Up @@ -78,11 +81,14 @@
output = output
)

api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
try:
api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
except Exception as e:
print(f"Unable to resolve API call: {e}")
28 changes: 17 additions & 11 deletions examples/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
from shotstack_sdk.model.title_asset import TitleAsset

if __name__ == "__main__":
configuration = shotstack.Configuration(
host = "https://api.shotstack.io/stage"
)
host = "https://api.shotstack.io/stage"

if os.getenv("SHOTSTACK_HOST") is not None:
host = os.getenv("SHOTSTACK_HOST")

configuration = shotstack.Configuration(host = host)

if os.getenv("SHOTSTACK_KEY") is None:
sys.exit("API Key is required. Set using: export SHOTSTACK_KEY=your_key_here")
Expand Down Expand Up @@ -80,11 +83,14 @@
merge = [merge_field]
)

api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
try:
api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
except Exception as e:
print(f"Unable to resolve API call: {e}")
28 changes: 17 additions & 11 deletions examples/picture_in_picture.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
from shotstack_sdk.model.video_asset import VideoAsset

if __name__ == "__main__":
configuration = shotstack.Configuration(
host = "https://api.shotstack.io/stage"
)
host = "https://api.shotstack.io/stage"

if os.getenv("SHOTSTACK_HOST") is not None:
host = os.getenv("SHOTSTACK_HOST")

configuration = shotstack.Configuration(host = host)

if os.getenv("SHOTSTACK_KEY") is None:
sys.exit("API Key is required. Set using: export SHOTSTACK_KEY=your_key_here")
Expand Down Expand Up @@ -115,11 +118,14 @@
output = output
)

api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
try:
api_response = api_instance.post_render(edit)

message = api_response['response']['message']
id = api_response['response']['id']

print("message\n")
print(">> Now check the progress of your render by running:")
print(f">> python examples/status.py {id}")
except Exception as e:
print(f"Unable to resolve API call: {e}")
16 changes: 7 additions & 9 deletions examples/probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
from shotstack_sdk.api import edit_api

if __name__ == "__main__":
configuration = shotstack.Configuration(
host = "https://api.shotstack.io/stage"
)
host = "https://api.shotstack.io/stage"

if os.getenv("SHOTSTACK_HOST") is not None:
host = os.getenv("SHOTSTACK_HOST")

configuration = shotstack.Configuration(host = host)

if os.getenv("SHOTSTACK_KEY") is None:
sys.exit("API Key is required. Set using: export SHOTSTACK_KEY=your_key_here")
Expand All @@ -21,12 +24,7 @@

if url is None:
sys.exit(">> Please provide the URL to a media file to inspect (i.e. python examples/probe.py https://github.com/shotstack/test-media/raw/main/captioning/scott-ko.mp4)\n")

apiUrl = "https://api.shotstack.io/stage"

if os.getenv("SHOTSTACK_HOST") is not None:
apiUrl = os.getenv("SHOTSTACK_HOST")


try:
api_response = api_instance.probe(url)

Expand Down
14 changes: 6 additions & 8 deletions examples/serve-api/asset_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
from shotstack_sdk.api import serve_api

if __name__ == "__main__":
configuration = shotstack.Configuration(
host = "https://api.shotstack.io/stage"
)
host = "https://api.shotstack.io/stage"

if os.getenv("SHOTSTACK_HOST") is not None:
host = os.getenv("SHOTSTACK_HOST")

configuration = shotstack.Configuration(host = host)

if os.getenv("SHOTSTACK_KEY") is None:
sys.exit("API Key is required. Set using: export SHOTSTACK_KEY=your_key_here")
Expand All @@ -22,11 +25,6 @@
if id is None:
sys.exit(">> Please provide the UUID of the render (i.e. python examples/serve-api/asset_id.py 2abd5c11-0f3d-4c6d-ba20-235fc9b8e8b7)\n")

apiUrl = "https://api.shotstack.io/stage"

if os.getenv("SHOTSTACK_HOST") is not None:
apiUrl = os.getenv("SHOTSTACK_HOST")

try:
api_response = api_instance.get_asset(id)

Expand Down
18 changes: 8 additions & 10 deletions examples/serve-api/render_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
from shotstack_sdk.api import serve_api

if __name__ == "__main__":
configuration = shotstack.Configuration(
host = "https://api.shotstack.io/stage"
)
host = "https://api.shotstack.io/stage"

if os.getenv("SHOTSTACK_HOST") is not None:
host = os.getenv("SHOTSTACK_HOST")

configuration = shotstack.Configuration(host = host)

if os.getenv("SHOTSTACK_KEY") is None:
sys.exit("API Key is required. Set using: export SHOTSTACK_KEY=your_key_here")
Expand All @@ -20,13 +23,8 @@
id = sys.argv[1]

if id is None:
sys.exit(">> Please provide the UUID of the asset (i.e. python examples/serve-api/render_id.py 2abd5c11-0f3d-4c6d-ba20-235fc9b8e8b7)\n")

apiUrl = "https://api.shotstack.io/stage"

if os.getenv("SHOTSTACK_HOST") is not None:
apiUrl = os.getenv("SHOTSTACK_HOST")

sys.exit(">> Please provide the UUID of the asset (i.e. python examples/serve-api/render_id.py 2abd5c11-0f3d-4c6d-ba20-235fc9b8e8b7)\n")

try:
api_response = api_instance.get_asset_by_render_id(id)

Expand Down
Loading