|
Odyssey
|
Functions | |
| def | get_parser () |
| def | cleanup_temp_file (tmp_file) |
| def | return_presigned_url (s3_client, object_key) |
| def | return_pdf_content (s3_client, s3_file_name) |
| def | main (argv) |
| def | run () |
Retrieve eStatement from AWS S3
Only the correct content is streamed to stdout. Any error must be
streamed down to stderr descriptor.
On failure, this script retries aws s3 api call for the number provided with
--s3-retries option argument. Default is MAX_RETRIES_DEFAULT.
Script Output:
Status code:
0, if no error
1, if any error, exceptions
Content (see usage for more detail):
PDF binary content, OR
S3 Presigned URL - has a short expiration duration
(ENV: AWS_S3_PRESIGNURL_EXPIRATION_SECONDS;
default: 120 seconds)
References:
[1] https://docs.aws.amazon.com/cli/latest/reference/s3/presign.html
[2] https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.generate_presigned_url | def EStateGetFromS3.cleanup_temp_file | ( | tmp_file | ) |
Cleanup temporarily downloaded estatement file
Definition at line 90 of file EStateGetFromS3.py.
| def EStateGetFromS3.get_parser | ( | ) |
Prepare argument parser.
Returns:
parser -- ArgumentParser object
Definition at line 63 of file EStateGetFromS3.py.
| def EStateGetFromS3.main | ( | argv | ) |
Retrieve eStatement from AWS S3 estatement storing bucket
Definition at line 133 of file EStateGetFromS3.py.
| def EStateGetFromS3.return_pdf_content | ( | s3_client, | |
| s3_file_name | |||
| ) |
Download pdf from S3 and return stream content to stdout
Definition at line 116 of file EStateGetFromS3.py.
| def EStateGetFromS3.return_presigned_url | ( | s3_client, | |
| object_key | |||
| ) |
| def EStateGetFromS3.run | ( | ) |
Script entrypoint
Definition at line 179 of file EStateGetFromS3.py.
| tuple EStateGetFromS3.format |
Definition at line 36 of file EStateGetFromS3.py.
| EStateGetFromS3.PRESIGN_URL_EXPIRATION_SECONDS |
Definition at line 59 of file EStateGetFromS3.py.
1.8.15