diff --git a/core/constraints/twitter.py b/core/constraints/twitter.py index 862a67f..6211800 100644 --- a/core/constraints/twitter.py +++ b/core/constraints/twitter.py @@ -230,7 +230,7 @@ def get_info(self, *args, **kwargs) -> None | dict: return None twitter_username = twitter.username - target_ids_list = self.param_values[ConstraintParam.TWITTER_IDS.name] + target_ids_list = list(map(str, self.param_values[ConstraintParam.TWITTER_IDS.name])) rapid_twitter = RapidTwitter() res = rapid_twitter.is_following_batch_with_cache( diff --git a/core/thirdpartyapp/twitter.py b/core/thirdpartyapp/twitter.py index faf5fc0..6597030 100644 --- a/core/thirdpartyapp/twitter.py +++ b/core/thirdpartyapp/twitter.py @@ -223,7 +223,7 @@ def is_following_batch( ) response.raise_for_status() data = response.json() - followings = set(data.get("ids", [])) + followings = set(map(str, data.get("ids", []))) for id_, is_following in res.items(): if is_following: continue @@ -237,7 +237,7 @@ def is_following_batch( def is_following_batch_with_cache( self, username: str, target_ids_list: list[str] ) -> dict[str:bool]: - cache_key = f'{self.get_user_id(username)}-{"-".join(map(str, target_ids_list))}' + cache_key = f'{self.get_user_id(username)}-{"-".join(target_ids_list)}' res = cache.get(cache_key) if res is not None: return res