Skip to main content

API - Data Export

Steps to download a data export file

  • Request the creation of the file based on a specific start_date and end_date.
  • Once the job is completed, use the job_id to get the credentials to download the file.
  • Using the credentials, initialize a S3 client which will be used to download the file. An example on how to create a S3 client from AWS docs
  • Download the file from S3 using the S3 client. Simply use the getObject method of the S3 client to download the file. An example on how to download a file from S3 using the S3 client from AWS docs

Example code in Python to download the file

import boto3
access_key="<access_key>"
secret_key="<secret_access_key>"
session_token="<session_token>"
session=boto3.Session(aws_access_key_id=access_key, aws_secret_access_key=secret_key, aws_session_token=session_token)
s3=session.resource('s3')
bucket=s3.Bucket("<bucket_name>")
bucket.download_file("<location>", "<my_file_name>")

Loading ...