From 5d30a21e4ad428084e8fdee09cb8f9eb7fea7bb8 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Tue, 11 Feb 2025 21:12:48 -0500 Subject: [PATCH] Make S3Bucket easier to use --- lib/nexrad/s3.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/nexrad/s3.py b/lib/nexrad/s3.py index dccdac8..b1232d9 100644 --- a/lib/nexrad/s3.py +++ b/lib/nexrad/s3.py @@ -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()