diff --git a/docs/utils/download.rst b/docs/utils/download.rst index 52c788dd1..f84621856 100644 --- a/docs/utils/download.rst +++ b/docs/utils/download.rst @@ -16,29 +16,33 @@ standard links from on-prem servers, while the second downloads data from the `A Example Usage ============== .. code-block:: python -data_url = 'https://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/2/3052/primary/acisf03052N004_cntr_img2.jpg' -image_file = http_download(url=data_url) -s3_uri = 's3://nasa-heasarc/chandra/data/byobsid/2/3052/primary/acisf03052N004_cntr_img2.jpg' -image2_file = aws_download(uri=data_url) + data_url = 'https://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/2/3052/primary/acisf03052N004_cntr_img2.jpg' + image_file = http_download(url=data_url) + + s3_uri = 's3://nasa-heasarc/chandra/data/byobsid/2/3052/primary/acisf03052N004_cntr_img2.jpg' + image2_file = aws_download(uri=data_url) or .. code-block:: python -s3_key = 'chandra/data/byobsid/2/3052/primary/acisf03052N004_cntr_img2.jpg's -s3_bucket = 'nasa-heasarc' -image2_file = aws_download(bucket=s3_bucket, key=s3_key) + + s3_key = 'chandra/data/byobsid/2/3052/primary/acisf03052N004_cntr_img2.jpg's + s3_bucket = 'nasa-heasarc' + image2_file = aws_download(bucket=s3_bucket, key=s3_key) If the aws data requires authentication, a credential profile (e.g. `aws_user` profile in ``~/.aws/credentials``) can be passed: .. code-block:: python -image2_file = aws_download(bucket=s3_bucket, key=s3_key, aws_profile='aws_user') + + image2_file = aws_download(bucket=s3_bucket, key=s3_key, aws_profile='aws_user') A session (instance of ``boto3.session.Session``) can also be passed instead (see detials in `AWS session documentation`_). .. code-block:: python -s3_session = boto3.session.Session(aws_access_key_id, aws_secret_access_key) -image2_file = aws_download(bucket=s3_bucket, key=s3_key, session=s3_session) + + s3_session = boto3.session.Session(aws_access_key_id, aws_secret_access_key) + image2_file = aws_download(bucket=s3_bucket, key=s3_key, session=s3_session) .. _Amazon S3 storage: https://aws.amazon.com/s3/