Skip to content

Commit

Permalink
fix(baiducloud): check access token expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
lss233 committed Apr 28, 2023
1 parent dbb2d16 commit cc1dc75
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions middlewares/baiducloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ async def check_and_update_access_token(self):
await self.get_access_token()

async def get_conclusion(self, text: str):
await self.check_and_update_access_token()

baidu_url = f"https://aip.baidubce.com/rest/2.0/solution/v1/text_censor/v2/user_defined" \
f"?access_token={self.access_token}"
headers = {'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'application/json'}
Expand Down

0 comments on commit cc1dc75

Please sign in to comment.