Skip to content

Instantly share code, notes, and snippets.

@andgineer
Last active October 15, 2021 05:22
Show Gist options
  • Save andgineer/1777396a8ed299fdd43e9d6c1869e01e to your computer and use it in GitHub Desktop.
Save andgineer/1777396a8ed299fdd43e9d6c1869e01e to your computer and use it in GitHub Desktop.
def create_object(s3=None):
session = get_session() if s3 is None else None
with session.create_client(
"s3"
) if s3 is None else contextlib.nullcontext() as s3_temp:
return (s3 or s3_temp).get_object(Bucket=bucket, Key=key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment