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

Method has_badge

scratchattach/site/user.py:718–733  ·  view source on GitHub ↗

Returns: bool: Whether the user has a scratch membership badge on their profile (located next to the follow button)

(self)

Source from the content-addressed store, hash-verified

716 return commons.webscrape_count(text, "Favorites (", ")")
717
718 def has_badge(self) -> bool:
719 """
720 Returns:
721 bool: Whether the user has a scratch membership badge on their profile (located next to the follow button)
722 """
723 with requests.no_error_handling():
724 resp = requests.get(self.url)
725 soup = BeautifulSoup(resp.text, "html.parser")
726 head = soup.find("div", {"class": "box-head"})
727 if not head:
728 return False
729 for child in head.children:
730 if child.name == "img":
731 if "membership-badge.svg" in child["src"]:
732 return True
733 return False
734
735 def toggle_commenting(self):
736 """

Callers 1

test_membershipsFunction · 0.80

Calls 3

no_error_handlingMethod · 0.45
getMethod · 0.45
findMethod · 0.45

Tested by 1

test_membershipsFunction · 0.64