forked from mtusi2026/mtusi2026lab4
14 lines
369 B
Python
14 lines
369 B
Python
import time
|
|
from app.main import s3, BUCKET
|
|
for attempt in range(60):
|
|
try:
|
|
client = s3()
|
|
if BUCKET not in [b['Name'] for b in client.list_buckets()['Buckets']]:
|
|
client.create_bucket(Bucket=BUCKET)
|
|
print('Private bucket ready')
|
|
break
|
|
except Exception:
|
|
if attempt == 59:
|
|
raise
|
|
time.sleep(1)
|