Commit fe1ab63e authored by Raphael Beer's avatar Raphael Beer

Fix: failing sensitives counting when user is not exising/protected

parent 6e852ffc
......@@ -27,13 +27,11 @@ async def test(session, username: str) -> Tuple[str, Dict[str, Any]]:
profile["screen_name"] = username
try:
profile["restriction"] = profile_raw["profile_interstitial_type"]
if profile_raw["profile_interstitial_type"] != "":
profile["restriction"] = profile_raw["profile_interstitial_type"]
except KeyError:
pass
if profile.get("restriction", None) == "":
del profile["restriction"]
try:
profile["protected"] = profile_raw["protected"]
except KeyError:
......@@ -50,6 +48,8 @@ async def test(session, username: str) -> Tuple[str, Dict[str, Any]]:
except KeyError:
profile["has_tweets"] = False
profile["sensitives"] = await count_sensitives(session, user_id)
if profile["exists"] and not profile.get("protected", False):
profile["sensitives"] = await count_sensitives(session, user_id)
return user_id, profile
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment