user-scanner 1.0.4.2__py3-none-any.whl → 1.0.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. user_scanner/__init__.py +0 -1
  2. user_scanner/__main__.py +24 -17
  3. user_scanner/cli/banner.py +2 -0
  4. user_scanner/community/coderlegion.py +11 -31
  5. user_scanner/core/orchestrator.py +72 -15
  6. user_scanner/creator/devto.py +11 -29
  7. user_scanner/creator/hashnode.py +19 -17
  8. user_scanner/creator/itch_io.py +12 -33
  9. user_scanner/creator/kaggle.py +11 -29
  10. user_scanner/creator/medium.py +11 -10
  11. user_scanner/creator/patreon.py +18 -38
  12. user_scanner/creator/producthunt.py +16 -14
  13. user_scanner/dev/codeberg.py +11 -29
  14. user_scanner/dev/cratesio.py +11 -24
  15. user_scanner/dev/dockerhub.py +11 -27
  16. user_scanner/dev/github.py +23 -36
  17. user_scanner/dev/gitlab.py +18 -30
  18. user_scanner/dev/launchpad.py +11 -24
  19. user_scanner/dev/npmjs.py +22 -19
  20. user_scanner/dev/replit.py +11 -29
  21. user_scanner/donation/__init__.py +0 -0
  22. user_scanner/donation/buymeacoffee.py +22 -0
  23. user_scanner/donation/liberapay.py +36 -0
  24. user_scanner/gaming/chess_com.py +23 -34
  25. user_scanner/gaming/minecraft.py +24 -0
  26. user_scanner/gaming/monkeytype.py +6 -18
  27. user_scanner/gaming/osu.py +14 -34
  28. user_scanner/gaming/roblox.py +21 -31
  29. user_scanner/gaming/steam.py +15 -29
  30. user_scanner/social/bluesky.py +21 -32
  31. user_scanner/social/discord.py +12 -13
  32. user_scanner/social/instagram.py +11 -24
  33. user_scanner/social/mastodon.py +18 -38
  34. user_scanner/social/pinterest.py +16 -30
  35. user_scanner/social/reddit.py +16 -30
  36. user_scanner/social/snapchat.py +24 -37
  37. user_scanner/social/telegram.py +13 -18
  38. user_scanner/social/threads.py +11 -24
  39. user_scanner/social/x.py +14 -12
  40. user_scanner/social/youtube.py +37 -34
  41. user_scanner/utils/version.py +2 -0
  42. user_scanner/version.json +1 -1
  43. {user_scanner-1.0.4.2.dist-info → user_scanner-1.0.6.0.dist-info}/METADATA +12 -53
  44. user_scanner-1.0.6.0.dist-info/RECORD +55 -0
  45. user_scanner-1.0.4.2.dist-info/RECORD +0 -51
  46. {user_scanner-1.0.4.2.dist-info → user_scanner-1.0.6.0.dist-info}/WHEEL +0 -0
  47. {user_scanner-1.0.4.2.dist-info → user_scanner-1.0.6.0.dist-info}/entry_points.txt +0 -0
  48. {user_scanner-1.0.4.2.dist-info → user_scanner-1.0.6.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,37 +1,19 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import status_validate
2
+
3
3
 
4
4
  def validate_codeberg(user):
5
5
  url = f"https://codeberg.org/{user}"
6
6
 
7
- headers = {
8
- 'User-Agent': "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Mobile Safari/537.36",
9
- 'Accept': "text/html",
10
- }
11
-
12
- try:
13
- response = httpx.head(url, headers=headers, timeout=3.0, follow_redirects=True)
14
- status = response.status_code
15
-
16
- if status == 200:
17
- return 0
18
- elif status == 404:
19
- return 1
20
- else:
21
- return 2
7
+ return status_validate(url, 404, 200, follow_redirects=True)
22
8
 
23
- except (ConnectError, TimeoutException):
24
- return 2
25
- except Exception:
26
- return 2
27
9
 
28
10
  if __name__ == "__main__":
29
- user = input ("Username?: ").strip()
30
- result = validate_codeberg(user)
11
+ user = input("Username?: ").strip()
12
+ result = validate_codeberg(user)
31
13
 
32
- if result == 1:
33
- print("Available!")
34
- elif result == 0:
35
- print("Unavailable!")
36
- else:
37
- print("Error occurred!")
14
+ if result == 1:
15
+ print("Available!")
16
+ elif result == 0:
17
+ print("Unavailable!")
18
+ else:
19
+ print("Error occurred!")
@@ -1,5 +1,5 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import status_validate
2
+
3
3
 
4
4
  def validate_cratesio(user):
5
5
  url = f"https://crates.io/api/v1/users/{user}"
@@ -11,29 +11,16 @@ def validate_cratesio(user):
11
11
  'sec-fetch-mode': "cors",
12
12
  }
13
13
 
14
- try:
15
- response = httpx.head(url, headers=headers, timeout=5.0)
16
- status = response.status_code
17
-
18
- if status == 200:
19
- return 0
20
- elif status == 404:
21
- return 1
22
- else:
23
- return 2
14
+ return status_validate(url, 404, 200, headers=headers)
24
15
 
25
- except (ConnectError, TimeoutException):
26
- return 2
27
- except Exception:
28
- return 2
29
16
 
30
17
  if __name__ == "__main__":
31
- user = input ("Username?: ").strip()
32
- result = validate_cratesio(user)
18
+ user = input("Username?: ").strip()
19
+ result = validate_cratesio(user)
33
20
 
34
- if result == 1:
35
- print("Available!")
36
- elif result == 0:
37
- print("Unavailable!")
38
- else:
39
- print("Error occurred!")
21
+ if result == 1:
22
+ print("Available!")
23
+ elif result == 0:
24
+ print("Unavailable!")
25
+ else:
26
+ print("Error occurred!")
@@ -1,5 +1,5 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import status_validate
2
+
3
3
 
4
4
  def validate_dockerhub(user):
5
5
  url = f"https://hub.docker.com/v2/users/{user}/"
@@ -9,32 +9,16 @@ def validate_dockerhub(user):
9
9
  'Accept': "application/json",
10
10
  }
11
11
 
12
- try:
13
- response = httpx.get(url, headers=headers, timeout=3.0)
14
- status = response.status_code
15
-
16
- # UNAVAILABLE (return 0) if the user API endpoint returns 200 OK
17
- if status == 200:
18
- return 0
19
- # AVAILABLE (return 1) if the user API endpoint returns 404 Not Found
20
- elif status == 404:
21
- return 1
22
- # Other status codes are errors
23
- else:
24
- return 2
12
+ return status_validate(url, 404, 200, headers=headers)
25
13
 
26
- except (ConnectError, TimeoutException):
27
- return 2
28
- except Exception:
29
- return 2
30
14
 
31
15
  if __name__ == "__main__":
32
- user = input ("Username?: ").strip()
33
- result = validate_dockerhub(user)
16
+ user = input("Username?: ").strip()
17
+ result = validate_dockerhub(user)
34
18
 
35
- if result == 1:
36
- print("Available!")
37
- elif result == 0:
38
- print("Unavailable!")
39
- else:
40
- print("Error occurred!")
19
+ if result == 1:
20
+ print("Available!")
21
+ elif result == 0:
22
+ print("Unavailable!")
23
+ else:
24
+ print("Error occurred!")
@@ -1,46 +1,33 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import status_validate
2
+
3
3
 
4
4
  def validate_github(user):
5
5
  url = f"https://github.com/signup_check/username?value={user}"
6
6
 
7
7
  headers = {
8
- 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36",
9
- 'Accept-Encoding': "gzip, deflate, br, zstd",
10
- 'sec-ch-ua-platform': "\"Linux\"",
11
- 'sec-ch-ua': "\"Chromium\";v=\"140\", \"Not=A?Brand\";v=\"24\", \"Google Chrome\";v=\"140\"",
12
- 'sec-ch-ua-mobile': "?0",
13
- 'sec-fetch-site': "same-origin",
14
- 'sec-fetch-mode': "cors",
15
- 'sec-fetch-dest': "empty",
16
- 'referer': "https://github.com/signup?source=form-home-signup&user_email=",
17
- 'accept-language': "en-US,en;q=0.9",
18
- 'priority': "u=1, i"
19
- }
20
-
21
- try:
22
- response = httpx.get(url, headers=headers, timeout = 3.0)
23
- status = response.status_code
8
+ 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36",
9
+ 'Accept-Encoding': "gzip, deflate, br, zstd",
10
+ 'sec-ch-ua-platform': "\"Linux\"",
11
+ 'sec-ch-ua': "\"Chromium\";v=\"140\", \"Not=A?Brand\";v=\"24\", \"Google Chrome\";v=\"140\"",
12
+ 'sec-ch-ua-mobile': "?0",
13
+ 'sec-fetch-site': "same-origin",
14
+ 'sec-fetch-mode': "cors",
15
+ 'sec-fetch-dest': "empty",
16
+ 'referer': "https://github.com/signup?source=form-home-signup&user_email=",
17
+ 'accept-language': "en-US,en;q=0.9",
18
+ 'priority': "u=1, i"
19
+ }
24
20
 
25
- if status == 200:
26
- return 1
27
- elif status == 422:
28
- return 0
29
- else:
30
- return 2
21
+ return status_validate(url, 200, 422, headers=headers)
31
22
 
32
- except (ConnectError, TimeoutException):
33
- return 2
34
- except Exception:
35
- return 2
36
23
 
37
24
  if __name__ == "__main__":
38
- user = input ("Username?: ").strip()
39
- result = validate_github(user)
25
+ user = input("Username?: ").strip()
26
+ result = validate_github(user)
40
27
 
41
- if result == 1:
42
- print("Available!")
43
- elif result == 0:
44
- print("Unavailable!")
45
- else:
46
- print("Error occured!")
28
+ if result == 1:
29
+ print("Available!")
30
+ elif result == 0:
31
+ print("Unavailable!")
32
+ else:
33
+ print("Error occured!")
@@ -1,23 +1,19 @@
1
- import httpx
2
- import json
3
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import generic_validate
2
+
4
3
 
5
4
  def validate_gitlab(user):
6
5
  url = f"https://gitlab.com/users/{user}/exists"
7
6
 
8
7
  headers = {
9
- 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36",
10
- 'Accept': "application/json, text/plain, */*",
11
- 'X-Requested-With': "XMLHttpRequest",
12
- 'Referer': "https://gitlab.com/users/sign_up",
8
+ 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36",
9
+ 'Accept': "application/json, text/plain, */*",
10
+ 'X-Requested-With': "XMLHttpRequest",
11
+ 'Referer': "https://gitlab.com/users/sign_up",
13
12
  }
14
13
 
15
- try:
16
- response = httpx.get(url, headers=headers, timeout=3.0)
17
-
14
+ def process(response):
18
15
  if response.status_code == 200:
19
16
  data = response.json()
20
-
21
17
  if 'exists' in data:
22
18
  # Corrected: Compare against Python boolean True/False
23
19
  # AVAILABLE (return 1) if "exists": true
@@ -26,26 +22,18 @@ def validate_gitlab(user):
26
22
  # UNAVAILABLE (return 0) if "exists": false
27
23
  elif data['exists'] is True:
28
24
  return 0
25
+ return 2
29
26
 
30
- return 2
31
-
32
- else:
33
- return 2
27
+ return generic_validate(url, process, headers=headers)
34
28
 
35
- except (ConnectError, TimeoutException):
36
- return 2
37
- except json.JSONDecodeError:
38
- return 2
39
- except Exception:
40
- return 2
41
29
 
42
30
  if __name__ == "__main__":
43
- user = input ("Username?: ").strip()
44
- result = validate_gitlab(user)
45
-
46
- if result == 1:
47
- print("Available!")
48
- elif result == 0:
49
- print("Unavailable!")
50
- else:
51
- print("Error occurred!")
31
+ user = input("Username?: ").strip()
32
+ result = validate_gitlab(user)
33
+
34
+ if result == 1:
35
+ print("Available!")
36
+ elif result == 0:
37
+ print("Unavailable!")
38
+ else:
39
+ print("Error occurred!")
@@ -1,5 +1,5 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import status_validate
2
+
3
3
 
4
4
  def validate_launchpad(user):
5
5
  url = f"https://launchpad.net/~{user}"
@@ -11,29 +11,16 @@ def validate_launchpad(user):
11
11
  'Upgrade-Insecure-Requests': "1",
12
12
  }
13
13
 
14
- try:
15
- response = httpx.head(url, headers=headers, timeout=5.0, follow_redirects=True)
16
- status = response.status_code
17
-
18
- if status == 200:
19
- return 0
20
- elif status == 404:
21
- return 1
22
- else:
23
- return 2
14
+ return status_validate(url, 404, 200, headers=headers, follow_redirects=True)
24
15
 
25
- except (ConnectError, TimeoutException):
26
- return 2
27
- except Exception:
28
- return 2
29
16
 
30
17
  if __name__ == "__main__":
31
- user = input ("Username?: ").strip()
32
- result = validate_launchpad(user)
18
+ user = input("Username?: ").strip()
19
+ result = validate_launchpad(user)
33
20
 
34
- if result == 1:
35
- print("Available!")
36
- elif result == 0:
37
- print("Unavailable!")
38
- else:
39
- print("Error occurred!")
21
+ if result == 1:
22
+ print("Available!")
23
+ elif result == 0:
24
+ print("Unavailable!")
25
+ else:
26
+ print("Error occurred!")
user_scanner/dev/npmjs.py CHANGED
@@ -1,40 +1,43 @@
1
1
  import httpx
2
2
  from httpx import ConnectError, TimeoutException
3
3
 
4
+
4
5
  def validate_npmjs(user):
5
6
  url = f"https://www.npmjs.com/~{user}"
6
7
 
7
8
  headers = {
8
- 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36",
9
- 'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
10
- 'Accept-Encoding': "gzip, deflate, br, zstd",
11
- 'accept-language': "en-US,en;q=0.9",
12
- 'priority': "u=0, i"
13
- }
9
+ 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36",
10
+ 'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
11
+ 'Accept-Encoding': "gzip, deflate, br, zstd",
12
+ 'accept-language': "en-US,en;q=0.9",
13
+ 'priority': "u=0, i"
14
+ }
14
15
 
15
16
  try:
16
- response = httpx.head(url, headers=headers, timeout=3.0, follow_redirects=True)
17
+ response = httpx.head(url, headers=headers,
18
+ timeout=3.0, follow_redirects=True)
17
19
  status = response.status_code
18
20
 
19
21
  if status == 200:
20
- return 0
22
+ return 0
21
23
  elif status == 404:
22
- return 1
24
+ return 1
23
25
  else:
24
- return 2
26
+ return 2
25
27
 
26
28
  except (ConnectError, TimeoutException):
27
29
  return 2
28
30
  except Exception:
29
31
  return 2
30
32
 
33
+
31
34
  if __name__ == "__main__":
32
- user = input ("Username?: ").strip()
33
- result = validate_npmjs(user)
34
-
35
- if result == 1:
36
- print("Available!")
37
- elif result == 0:
38
- print("Unavailable!")
39
- else:
40
- print("Error occurred!")
35
+ user = input("Username?: ").strip()
36
+ result = validate_npmjs(user)
37
+
38
+ if result == 1:
39
+ print("Available!")
40
+ elif result == 0:
41
+ print("Unavailable!")
42
+ else:
43
+ print("Error occurred!")
@@ -1,37 +1,19 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import status_validate
2
+
3
3
 
4
4
  def validate_replit(user):
5
5
  url = f"https://replit.com/@{user}"
6
6
 
7
- headers = {
8
- 'User-Agent': "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Mobile Safari/537.36",
9
- 'Accept': "text/html",
10
- }
11
-
12
- try:
13
- response = httpx.head(url, headers=headers, timeout=3.0, follow_redirects=True)
14
- status = response.status_code
15
-
16
- if status == 200:
17
- return 0
18
- elif status == 404:
19
- return 1
20
- else:
21
- return 2
7
+ return status_validate(url, 404, 200, follow_redirects=True)
22
8
 
23
- except (ConnectError, TimeoutException):
24
- return 2
25
- except Exception:
26
- return 2
27
9
 
28
10
  if __name__ == "__main__":
29
- user = input ("Username?: ").strip()
30
- result = validate_replit(user)
11
+ user = input("Username?: ").strip()
12
+ result = validate_replit(user)
31
13
 
32
- if result == 1:
33
- print("Available!")
34
- elif result == 0:
35
- print("Unavailable!")
36
- else:
37
- print("Error occurred!")
14
+ if result == 1:
15
+ print("Available!")
16
+ elif result == 0:
17
+ print("Unavailable!")
18
+ else:
19
+ print("Error occurred!")
File without changes
@@ -0,0 +1,22 @@
1
+ import httpx
2
+ from httpx import ConnectError, TimeoutException
3
+
4
+ from user_scanner.core.orchestrator import status_validate
5
+
6
+
7
+ def validate_buymeacoffee(user):
8
+ url = f"https://buymeacoffee.com/{user}"
9
+
10
+ return status_validate(url, 404, 200, follow_redirects=True)
11
+
12
+
13
+ if __name__ == "__main__":
14
+ user = input("Username?: ").strip()
15
+ result = validate_buymeacoffee(user)
16
+
17
+ if result == 1:
18
+ print("Available!")
19
+ elif result == 0:
20
+ print("Unavailable!")
21
+ else:
22
+ print("Error occurred!")
@@ -0,0 +1,36 @@
1
+ from user_scanner.core.orchestrator import status_validate
2
+
3
+
4
+ def validate_liberapay(user):
5
+ url = f"https://en.liberapay.com/{user}"
6
+
7
+ headers = {
8
+ "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
9
+ "accept-language": "en-Us,pt;q=0.6",
10
+ "cache-control": "no-cache",
11
+ "pragma": "no-cache",
12
+ "priority": "u=0, i",
13
+ "sec-ch-ua": '"Chromium";v="142", "Brave";v="142", "Not_A Brand";v="99"',
14
+ "sec-ch-ua-mobile": "?0",
15
+ "sec-ch-ua-platform": '"Windows"',
16
+ "sec-fetch-dest": "document",
17
+ "sec-fetch-mode": "navigate",
18
+ "sec-fetch-site": "none",
19
+ "sec-fetch-user": "?1",
20
+ "sec-gpc": "1",
21
+ "upgrade-insecure-requests": "1",
22
+ }
23
+
24
+ return status_validate(url, 404, 200, headers=headers, follow_redirects=True)
25
+
26
+
27
+ if __name__ == "__main__":
28
+ user = input("Username?: ").strip()
29
+ result = validate_liberapay(user)
30
+
31
+ if result == 1:
32
+ print("Available!")
33
+ elif result == 0:
34
+ print("Unavailable!")
35
+ else:
36
+ print("Error occurred!")
@@ -1,6 +1,5 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
3
- import json
1
+ from user_scanner.core.orchestrator import generic_validate
2
+
4
3
 
5
4
  def validate_chess_com(user):
6
5
  url = f"https://www.chess.com/callback/user/valid?username={user}"
@@ -12,43 +11,33 @@ def validate_chess_com(user):
12
11
  'Accept-Language': "en-US,en;q=0.9",
13
12
  }
14
13
 
15
- try:
16
- response = httpx.get(url, headers=headers, timeout = 3.0)
17
- status = response.status_code
18
-
19
- if status == 200:
14
+ def process(response):
15
+ if response.status_code == 200:
20
16
  data = response.json()
21
17
  if data.get('valid') is True:
22
18
  # 'valid': true means the username is NOT taken
23
- return 1
19
+ return 1
24
20
  elif data.get('valid') is False:
25
21
  # 'valid': false means the username IS taken
26
22
  return 0
27
- else:
28
- return 2
29
- else:
30
- return 2
31
-
32
- except (ConnectError, TimeoutException):
33
- return 2
34
- except json.JSONDecodeError:
35
- return 2
36
- except Exception:
37
23
  return 2
38
24
 
25
+ return generic_validate(url, process, headers=headers)
26
+
27
+
39
28
  if __name__ == "__main__":
40
- try:
41
- import httpx
42
- except ImportError:
43
- print("Error: 'httpx' library is not installed.")
44
- exit()
45
-
46
- user = input ("Username?: ").strip()
47
- result = validate_chess_com(user)
48
-
49
- if result == 1:
50
- print("Available!")
51
- elif result == 0:
52
- print("Unavailable!")
53
- else:
54
- print("Error occured!")
29
+ try:
30
+ import httpx
31
+ except ImportError:
32
+ print("Error: 'httpx' library is not installed.")
33
+ exit()
34
+
35
+ user = input("Username?: ").strip()
36
+ result = validate_chess_com(user)
37
+
38
+ if result == 1:
39
+ print("Available!")
40
+ elif result == 0:
41
+ print("Unavailable!")
42
+ else:
43
+ print("Error occured!")
@@ -0,0 +1,24 @@
1
+ from user_scanner.core.orchestrator import status_validate
2
+
3
+
4
+ def validate_minecraft(user):
5
+ """
6
+ Checks for minecraft username with mojang api.
7
+ Returns: 1 -> available, 0 -> taken, 2 -> error
8
+ """
9
+
10
+ url = f"https://api.mojang.com/minecraft/profile/lookup/name/{user}"
11
+
12
+ return status_validate(url, 404, 200, follow_redirects=True)
13
+
14
+
15
+ if __name__ == "__main__":
16
+ user = input("Username?: ").strip()
17
+ result = validate_minecraft(user)
18
+
19
+ if result == 1:
20
+ print("Available!")
21
+ elif result == 0:
22
+ print("Unavailable!")
23
+ else:
24
+ print("Error occurred!")
@@ -1,6 +1,5 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
3
- import json
1
+ from user_scanner.core.orchestrator import generic_validate
2
+
4
3
 
5
4
  def validate_monkeytype(user: str) -> int:
6
5
 
@@ -17,11 +16,8 @@ def validate_monkeytype(user: str) -> int:
17
16
  "Accept-Language": "en-US,en;q=0.9",
18
17
  }
19
18
 
20
- try:
21
- response = httpx.get(url, headers=headers, timeout=3.0)
22
- status = response.status_code
23
-
24
- if status == 200:
19
+ def process(response):
20
+ if response.status_code == 200:
25
21
  data = response.json()
26
22
  # Expected shape:
27
23
  # { "message": "string", "data": { "available": true/false } }
@@ -32,18 +28,10 @@ def validate_monkeytype(user: str) -> int:
32
28
  return 1
33
29
  elif available is False:
34
30
  return 0
35
- else:
36
- return 2
37
- else:
38
- return 2
39
-
40
- except (ConnectError, TimeoutException):
41
- return 2
42
- except json.JSONDecodeError:
43
- return 2
44
- except Exception:
45
31
  return 2
46
32
 
33
+ return generic_validate(url, process, headers=headers)
34
+
47
35
 
48
36
  if __name__ == "__main__":
49
37
  try: