Skip to content

Commit

Permalink
Fix twitter batch
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSullivan committed Aug 12, 2024
1 parent b5c7b3d commit 3c57eb9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/constraints/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions core/thirdpartyapp/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 3c57eb9

Please sign in to comment.