初始化项目
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
from typing import Union
|
||||
import base64
|
||||
from urllib.parse import quote, urlencode
|
||||
from dock.govs import govs_api
|
||||
|
||||
|
||||
async def get_download_request(tenant_id: Union[int, str], file_url: str):
|
||||
"""
|
||||
创建从省12345下载文件的请求对象。方法仅创建请求对象,并未实际提交请求,具体由调度方法处理。
|
||||
|
||||
:param tenant_id: 租户id
|
||||
:param file_url: 文件url
|
||||
"""
|
||||
api_url = '/file/api/system/downloadPermission'
|
||||
b64_file_url = base64.b64encode(file_url.encode()).decode()
|
||||
b64_file_url = quote(b64_file_url, safe="~*'()!.-_")
|
||||
body = {
|
||||
'tenantId': tenant_id,
|
||||
'fileUrl': b64_file_url
|
||||
}
|
||||
api_url += f'?{urlencode(body)}'
|
||||
return await govs_api.new_api_request(api_url, {})
|
||||
Reference in New Issue
Block a user