Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
unify_api2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chaonan
unify_api2
Commits
c607b9ea
Commit
c607b9ea
authored
Mar 08, 2024
by
ZZH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
news upload to public Qs bucket 2024-03-8
parent
4c88642c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
file_operate_pds.py
unify_api/modules/common/procedures/file_operate_pds.py
+3
-2
news_mgr_srv.py
unify_api/modules/qkadmin/service/news_mgr_srv.py
+1
-1
No files found.
unify_api/modules/common/procedures/file_operate_pds.py
View file @
c607b9ea
...
...
@@ -5,12 +5,13 @@ DATE:2024/3/6 13:47
"""
from
pot_libs.logger
import
log
from
pot_libs.qingstor_util.qs_client
import
QsClient
from
pot_libs.settings
import
SETTING
async
def
upload_file
(
file
,
qs_url
):
async
def
upload_file
(
file
,
qs_url
,
bucket
=
SETTING
.
qingstor_bucket
):
file_body
=
file
.
body
if
file_body
:
async
with
QsClient
()
as
client
:
async
with
QsClient
(
bucket
)
as
client
:
resp
=
await
client
.
put_file
(
key
=
qs_url
,
data
=
file_body
)
log
.
info
(
f
"upload to qingstor the resp: {resp} {qs_url}"
)
return
1
...
...
unify_api/modules/qkadmin/service/news_mgr_srv.py
View file @
c607b9ea
...
...
@@ -24,7 +24,7 @@ async def upload_file_helper(file):
file_url
=
f
"{OSS_NEWS}/{yr}/{month}/{uuid4()}.{file_name_lst[1]}"
log
.
info
(
f
"准备上传文件 {file_name} {file_url}"
)
is_upload
=
await
upload_file
(
file
,
file_url
)
is_upload
=
await
upload_file
(
file
,
file_url
,
bucket
=
"qk-public-dev"
)
return
is_upload
,
file_url
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment