mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-08 17:08:35 +08:00
fix 阿里云盘会话提示
This commit is contained in:
@@ -27,6 +27,10 @@ class NoCheckInException(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class SessionInvalidException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AliPan(StorageBase, metaclass=Singleton):
|
class AliPan(StorageBase, metaclass=Singleton):
|
||||||
"""
|
"""
|
||||||
阿里云盘相关操作
|
阿里云盘相关操作
|
||||||
@@ -185,7 +189,7 @@ class AliPan(StorageBase, metaclass=Singleton):
|
|||||||
确认登录后,获取相关token
|
确认登录后,获取相关token
|
||||||
"""
|
"""
|
||||||
if not self._auth_state:
|
if not self._auth_state:
|
||||||
raise Exception("【阿里云盘】请先生成二维码")
|
raise SessionInvalidException("【阿里云盘】请先生成二维码")
|
||||||
resp = self.session.post(
|
resp = self.session.post(
|
||||||
f"{self.base_url}/oauth/access_token",
|
f"{self.base_url}/oauth/access_token",
|
||||||
json={
|
json={
|
||||||
@@ -196,7 +200,7 @@ class AliPan(StorageBase, metaclass=Singleton):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
if resp is None:
|
if resp is None:
|
||||||
raise Exception("【阿里云盘】获取 access_token 失败")
|
raise SessionInvalidException("【阿里云盘】获取 access_token 失败")
|
||||||
result = resp.json()
|
result = resp.json()
|
||||||
if result.get("code"):
|
if result.get("code"):
|
||||||
raise Exception(f"【阿里云盘】{result.get('code')} - {result.get('message')}!")
|
raise Exception(f"【阿里云盘】{result.get('code')} - {result.get('message')}!")
|
||||||
@@ -207,7 +211,7 @@ class AliPan(StorageBase, metaclass=Singleton):
|
|||||||
刷新access_token
|
刷新access_token
|
||||||
"""
|
"""
|
||||||
if not refresh_token:
|
if not refresh_token:
|
||||||
raise Exception("【阿里云盘】会话失效,请重新扫码登录!")
|
raise SessionInvalidException("【阿里云盘】会话失效,请重新扫码登录!")
|
||||||
resp = self.session.post(
|
resp = self.session.post(
|
||||||
f"{self.base_url}/oauth/access_token",
|
f"{self.base_url}/oauth/access_token",
|
||||||
json={
|
json={
|
||||||
@@ -1012,3 +1016,5 @@ class AliPan(StorageBase, metaclass=Singleton):
|
|||||||
)
|
)
|
||||||
except NoCheckInException:
|
except NoCheckInException:
|
||||||
return None
|
return None
|
||||||
|
except SessionInvalidException:
|
||||||
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user