mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-21 22:58:05 +00:00
🎨 Add handling for InvalidDevice
exception to PublicCookiesService
This commit is contained in:
parent
c4c452fb60
commit
30ad0151e2
@ -11,7 +11,7 @@ from gram_core.services.cookies.services import (
|
||||
)
|
||||
|
||||
from simnet import GenshinClient, Region, Game
|
||||
from simnet.errors import InvalidCookies, TooManyRequests, BadRequest as SimnetBadRequest, NeedChallenge
|
||||
from simnet.errors import InvalidCookies, TooManyRequests, BadRequest as SimnetBadRequest, NeedChallenge, InvalidDevice
|
||||
|
||||
from utils.log import logger
|
||||
|
||||
@ -79,6 +79,11 @@ class PublicCookiesService(BaseService, BasePublicCookiesService):
|
||||
await self.set_device_valid(client.account_id, False)
|
||||
await self._cache.delete_public_cookies(cookies.user_id, region)
|
||||
raise NeedContinue
|
||||
except InvalidDevice:
|
||||
logger.warning("用户 [%s] 设备信息无效", public_id)
|
||||
await self.set_device_valid(client.account_id, False)
|
||||
await self._cache.delete_public_cookies(cookies.user_id, region)
|
||||
raise NeedContinue
|
||||
except SimnetBadRequest as exc:
|
||||
if "invalid content type" in exc.message:
|
||||
raise exc
|
||||
|
Loading…
Reference in New Issue
Block a user