新增更新token,提交素材,前测模板管理
This commit is contained in:
@@ -37,6 +37,7 @@ class DouyinApi:
|
||||
options
|
||||
)
|
||||
|
||||
#上传视频素材
|
||||
async def upload_video_material(self, oauth_id: str, data: Optional[Dict[str, Any]] = None, files: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
||||
if not oauth_id:
|
||||
raise RuntimeError('OAuth ID is not set.')
|
||||
@@ -65,4 +66,16 @@ class DouyinApi:
|
||||
url,
|
||||
'GET',
|
||||
{'params': params or {}}
|
||||
)
|
||||
|
||||
#前测素材,Adv创建前测任务
|
||||
async def pre_test_material(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/diagnosis_task/adv/create/"
|
||||
return await self.request.request_with_token_with_context(
|
||||
oauth_id,
|
||||
url,
|
||||
'POST',
|
||||
{"json": params or {}}
|
||||
)
|
||||
@@ -186,7 +186,7 @@ class DouyinRequest:
|
||||
oauth_id: str,
|
||||
url: str,
|
||||
method: str = 'GET',
|
||||
options: Optional[Dict[str, Any]] = None,
|
||||
options: any = None,
|
||||
) -> Any:
|
||||
options = options or {}
|
||||
token = await self.get_access_token(oauth_id)
|
||||
@@ -229,7 +229,7 @@ class DouyinRequest:
|
||||
await asyncio.sleep(wait_time)
|
||||
continue
|
||||
|
||||
if code >= 50000:
|
||||
if code == 50000:
|
||||
await asyncio.sleep(i * 10)
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user