This tutorial shows how to use signed urls to create jobs with private objects stored in AWS S3
The AWS Simple Storage Service (S3) can be used as a source for jobs. If your
audio already resides on S3, you can process it there directly with pyannoteAI
APIs by providing temporary access credentials to your data.
A pre-signed URL can be a convenient way to provide a URL containing temporary
credentials as a basic string. pyannoteAI Jobs APIs need to GET the url parameter
when reading it. Therefore, to make a request with pre-signed URLs, you’ll need
to generate it.Here’s an example for how to do this:
generate-signed-url.py
Copy
# pip install boto3import boto3from botocore.exceptions import ClientErrordef create_presigned_url(bucket_name, object_name, operation='get_object', expiration=3600): client = boto3.client('s3') try: return client.generate_presigned_url(operation, Params={'Bucket': bucket_name, 'Key': object_name}, ExpiresIn=expiration ) except ClientError as e: print(e)# Use the presigned URL as the input parametersigned_url = presign.create_presigned_url('your-bucket-name', 'object/name.mp3')request = { 'url': signed_url,}# ... send the request to the Job API