in probe_scraper/probe_expiry_alert.py [0:0]
def check_bugzilla_user_exists(email: str, api_key: str):
user_response = requests.get(
BUGZILLA_USER_URL + "?names=" + email, headers=bugzilla_request_header(api_key)
)
try:
user_response.raise_for_status()
except requests.exceptions.HTTPError as e:
# 400 is raised if user does not exist
if e.response.status_code == 400 and e.response.json()["code"] == 51:
return False
raise
# As of Sept 2020, api seems to be returning 200 response with an unknown
# error code when user isn't found
if user_response.json().get("error"):
return False
return user_response.json()["users"][0]["can_login"]