Skip to content

Commit

Permalink
chore: add oss get_full_link
Browse files Browse the repository at this point in the history
  • Loading branch information
shengchenyang committed Mar 2, 2024
1 parent a599411 commit 009ac20
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ayugespidertools/extras/oss.py
Expand Up @@ -72,3 +72,16 @@ def put_oss(

oss_file_path = f"{self.doc}/{file}" if self.doc else file
self.bucket.put_object(oss_file_path, put_bytes)

def get_full_link(self, file: str) -> str:
"""获取文件的完整链接
Args:
file: 当前文件
Returns:
1). 当前文件的完整链接
"""
ep = self.endpoint.replace("https://", "", 1).replace("http://", "", 1)
oss_file_path = f"{self.doc}/{file}" if self.doc else file
return f"https://{self.bk}.{ep}/{oss_file_path}"

0 comments on commit 009ac20

Please sign in to comment.