2022-02-22 15:03:35 +00:00
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
|
|
|
|
|
|
|
|
class Storage(ABC):
|
|
|
|
@abstractmethod
|
|
|
|
def __init__(self, config): pass
|
|
|
|
|
|
|
|
@abstractmethod
|
2022-03-15 10:32:39 +00:00
|
|
|
def get_cdn_url(self, key): pass
|
2022-02-22 15:03:35 +00:00
|
|
|
|
|
|
|
@abstractmethod
|
2022-03-15 10:32:39 +00:00
|
|
|
def exists(self, key): pass
|
2022-02-22 15:03:35 +00:00
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def uploadf(self, file, key, **kwargs): pass
|
|
|
|
|
|
|
|
def upload(self, filename: str, key: str, **kwargs):
|
|
|
|
with open(filename, 'rb') as f:
|
|
|
|
self.uploadf(f, key, **kwargs)
|