新增素材更新功能

This commit is contained in:
18610128193
2026-06-23 14:16:31 +08:00
parent b88546ab66
commit 242030c50b
11 changed files with 1109 additions and 7 deletions
+24
View File
@@ -78,4 +78,28 @@ class DouyinApi:
url,
'POST',
{"json": params or {}}
)
#获取素材消耗
async def get_material_cost(self, oauth_id: str, params: any, request_count: int = 3) -> Dict[str, Any]:
if not oauth_id:
raise RuntimeError('OAuth ID is not set.')
url = "https://api.oceanengine.com/open_api/v3.0/report/custom/get/"
return await self.request.request_with_token_with_context(
oauth_id,
url,
'GET',
{'params': params or {}},
request_count=request_count
)
#获取账户信息
async def get_account_info(self, oauth_id: str, params: any) -> Dict[str, Any]:
if not oauth_id:
raise RuntimeError('OAuth ID is not set.')
url = "https://api.oceanengine.com/open_api/2/agent/advertiser_info/query/"
return await self.request.request_with_token_with_context(
oauth_id,
url,
'GET',
{'params': params or {}}
)
+3 -1
View File
@@ -187,11 +187,13 @@ class DouyinRequest:
url: str,
method: str = 'GET',
options: any = None,
request_count: int = 1,
) -> Any:
options = options or {}
token = await self.get_access_token(oauth_id)
for i in range(1, 2):
for i in range(1, request_count+1):
# 有一些错误是触发频次管理的,需要重试
try:
headers = options.get('headers', {}).copy()
headers['Access-Token'] = token