How to use an if statement or similar in function arguments to reduce blocks of code?
if versionid is None:
s3_response = s3_client.head_object(
Bucket=bucket
, Key=key
)
else:
s3_response = s3_client.head_object(
Bucket=bucket
, Key=key
, VersionId=versionid
)
to something like this:
s3_response = s3_client.head_object(
Bucket=bucket
, Key=key
, if versionid is not None: VersionId=versionid
)
Not able to get this working and can't find any examples so assume not possible.