Last active
May 20, 2020 11:32
-
-
Save kshailen/449c47e2b59f98ac65247604fb9dfaa9 to your computer and use it in GitHub Desktop.
Checking if any bucket has multipart uploads or not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
def check_multipart_upload(bucket): | |
client = boto3.client('s3') | |
response_multipart = client.list_multipart_uploads(Bucket=bucket) | |
if "Uploads" in response_multipart.keys(): | |
return True | |
return False | |
def main(): | |
Bucket_list = ['complianx-xxdbox', 'corp-jenkins-xxxx'] | |
# You can change bucket list as per your usecase | |
for buck in Bucket_list: | |
print(buck + " : " + str(check_multipart_upload(buck))) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment