Skip to content

Commit

Permalink
Merge pull request #76 from OVINC-CN/feat_cos_accelerate
Browse files Browse the repository at this point in the history
feat: cos accelerate access
  • Loading branch information
OrenZhang authored Aug 29, 2024
2 parents 5b7f3c9 + 19d54dc commit 8c6a928
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/cos/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class COSCredential:
token: str
start_time: int
expired_time: int
use_accelerate: bool


class COSClient:
Expand Down Expand Up @@ -107,6 +108,7 @@ async def generate_cos_upload_credential(self, filename: str) -> COSCredential:
token=response["credentials"]["sessionToken"],
start_time=response["startTime"],
expired_time=response["expiredTime"],
use_accelerate=settings.QCLOUD_COS_USE_ACCELERATE,
)
except Exception as err:
logger.exception("[TempKeyGenerateFailed] %s", err)
Expand Down
1 change: 1 addition & 0 deletions entry/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
QCLOUD_COS_RANDOM_KEY_LENGTH = int(os.getenv("QCLOUD_COS_RANDOM_KEY_LENGTH", "10"))
QCLOUD_KEY_DUPLICATE_TIMEOUT = int(os.getenv("QCLOUD_KEY_DUPLICATE_TIMEOUT", str(60 * 60 * 24)))
QCLOUD_COS_IMAGE_STYLE = os.getenv("QCLOUD_COS_IMAGE_STYLE", "imageMogr2/quality/80/format/webp/interlace/1")
QCLOUD_COS_USE_ACCELERATE = strtobool(os.getenv("QCLOUD_COS_USE_ACCELERATE", "False"))

# STS
QCLOUD_API_DOMAIN_TMPL = os.getenv("QCLOUD_API_DOMAIN_TMPL", "{}.tencentcloudapi.com")
Expand Down

0 comments on commit 8c6a928

Please sign in to comment.