Make S3Bucket easier to use
This commit is contained in:
parent
b5f569180b
commit
5d30a21e4a
1 changed files with 7 additions and 2 deletions
|
@ -1,6 +1,11 @@
|
||||||
import re
|
import re
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
import boto3
|
||||||
|
|
||||||
|
from botocore import UNSIGNED
|
||||||
|
from botocore.config import Config
|
||||||
|
|
||||||
S3_BUCKET = 'noaa-nexrad-level2'
|
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})[_\.]')
|
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
|
name: str
|
||||||
cache: dict
|
cache: dict
|
||||||
|
|
||||||
def __init__(self, s3, name: str=S3_BUCKET):
|
def __init__(self, name: str=S3_BUCKET):
|
||||||
self.s3 = s3
|
self.s3 = boto3.client('s3', config=Config(signature_version=UNSIGNED))
|
||||||
self.name = name
|
self.name = name
|
||||||
self.cache = dict()
|
self.cache = dict()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue