How to Manage Scripts in the AudioStack API
When working with lots of scripts, it's important to be able to easily find the one you're looking for, and to structure your scripts according to the relevant project.
import audiostack
import os
"""
Hello! Welcome to the audiostack python SDK.
"""
BASE_URL = "http://v2.api.audio"
KEY = os.environ['AUDIOSTACK_API_KEY']
audiostack.api_base = BASE_URL
audiostack.api_key = KEY
text = """
Hey how are you today?
"""
print(f"Creating your script...")
script = audiostack.Content.Script.create(scriptText=text,
projectName="first_project",
moduleName="first_module",
scriptName="first_script")
print(script)
Let's break that down a bit. You can name a script, and that script lives within a module and that module lives within a project name.
Create a second script and module
import audiostack
import os
"""
Hello! Welcome to the audiostack python SDK.
"""
BASE_URL = "http://v2.api.audio"
KEY = os.environ['AUDIOSTACK_API_KEY']
audiostack.api_base = BASE_URL
audiostack.api_key = KEY
text = """
Second script
"""
print(f"Creating your script...")
script = audiostack.Content.Script.create(scriptText=text, projectName="first_project",
moduleName="second_module",
scriptName="second_script")
print(script)
In this example we create a second script with new text. And we save it under the same projectName, but with a different module name and a new script name.
Updated 6 months ago