Make S3Bucket easier to use

This commit is contained in:
XANTRONIX Industrial 2025-02-11 21:12:48 -05:00
parent b5f569180b
commit 5d30a21e4a

View file

@ -1,6 +1,11 @@
import re
import datetime
import boto3
from botocore import UNSIGNED
from botocore.config import Config
S3_BUCKET = 'noaa-nexrad-level2'
S3_KEY_RE = re.compile(r'^(\d{4})/(\d{2})/(\d{2})/([A-Z]{4})/([A-Z]{4})(\d{4})(\d{2})(\d{2})_(\d{2})(\d{2})(\d{2})[_\.]')
@ -28,8 +33,8 @@ class S3Bucket():
name: str
cache: dict
def __init__(self, s3, name: str=S3_BUCKET):
self.s3 = s3
def __init__(self, name: str=S3_BUCKET):
self.s3 = boto3.client('s3', config=Config(signature_version=UNSIGNED))
self.name = name
self.cache = dict()