MCPcopy Create free account
hub / github.com/TimMcCool/scratchattach / stats

Method stats

scratchattach/site/user.py:1129–1151  ·  view source on GitHub ↗

Gets information about the user's stats. Fetched from ScratchDB. Warning: ScratchDB is down indefinitely, therefore this method is deprecated. Returns: dict: A dict containing the user's stats. If the stats aren't available, all values will be -1.

(self)

Source from the content-addressed store, hash-verified

1127
1128 @deprecated("This method is deprecated because ScratchDB is down indefinitely.")
1129 def stats(self):
1130 """
1131 Gets information about the user's stats. Fetched from ScratchDB.
1132
1133 Warning:
1134 ScratchDB is down indefinitely, therefore this method is deprecated.
1135
1136 Returns:
1137 dict: A dict containing the user's stats. If the stats aren't available, all values will be -1.
1138 """
1139 try:
1140 stats = requests.get(f"https://scratchdb.lefty.one/v3/user/info/{self.username}").json()["statistics"]
1141 stats.pop("ranks")
1142 except Exception:
1143 stats = {
1144 "loves": -1,
1145 "favorites": -1,
1146 "comments": -1,
1147 "views": -1,
1148 "followers": -1,
1149 "following": -1,
1150 }
1151 return stats
1152
1153 @deprecated("Warning: ScratchDB is down indefinitely, therefore this method is deprecated.")
1154 def ranks(self):

Callers

nothing calls this directly

Calls 2

jsonMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected