github-monitor 2.2__py3-none-any.whl → 2.2.1__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.

Potentially problematic release.


This version of github-monitor might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: github_monitor
3
- Version: 2.2
3
+ Version: 2.2.1
4
4
  Summary: Tool implementing real-time tracking of Github users activities including profile and repositories changes
5
5
  Author-email: Michal Szymanski <misiektoja-pypi@rm-rf.ninja>
6
6
  License-Expression: GPL-3.0-or-later
@@ -0,0 +1,7 @@
1
+ github_monitor.py,sha256=y-KCw1m1Z_ck3dy81Wu0WGtmJY5wJXRtOKJhaVFp-rI,138012
2
+ github_monitor-2.2.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
3
+ github_monitor-2.2.1.dist-info/METADATA,sha256=TBFgooDz_els2Fgm4wMNoP1dcNMirFtq61DnbGAi6ls,17461
4
+ github_monitor-2.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
+ github_monitor-2.2.1.dist-info/entry_points.txt,sha256=hV03y00u1L16S5BwBSLQvFsZcL2WGRtjzlrmu9U9SN0,55
6
+ github_monitor-2.2.1.dist-info/top_level.txt,sha256=HDN2988ydvH9JZT32PushzqrcD05Q5qg960vgHGIaI8,15
7
+ github_monitor-2.2.1.dist-info/RECORD,,
github_monitor.py CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
  """
3
3
  Author: Michal Szymanski <misiektoja-github@rm-rf.ninja>
4
- v2.2
4
+ v2.2.1
5
5
 
6
6
  OSINT tool implementing real-time tracking of GitHub users activities including profile and repositories changes:
7
7
  https://github.com/misiektoja/github_monitor/
@@ -16,7 +16,7 @@ tzlocal (optional)
16
16
  python-dotenv (optional)
17
17
  """
18
18
 
19
- VERSION = "2.2"
19
+ VERSION = "2.2.1"
20
20
 
21
21
  # ---------------------------
22
22
  # CONFIGURATION SECTION START
@@ -1198,6 +1198,13 @@ def format_body_block(content, indent=" "):
1198
1198
  return f"\n{indented}"
1199
1199
 
1200
1200
 
1201
+ # Returns the base web URL for GitHub or GHE (e.g. https://github.com or https://ghe.example.com)
1202
+ def github_web_base() -> str:
1203
+ if "api.github.com" in GITHUB_API_URL:
1204
+ return "https://github.com"
1205
+ return GITHUB_API_URL.replace("/api/v3", "").rstrip("/")
1206
+
1207
+
1201
1208
  # Prints details about passed GitHub event
1202
1209
  def github_print_event(event, g, time_passed=False, ts: datetime | None = None):
1203
1210
 
@@ -1232,7 +1239,9 @@ def github_print_event(event, g, time_passed=False, ts: datetime | None = None):
1232
1239
  pass
1233
1240
 
1234
1241
  repo_name = getattr(repo, "full_name", event.repo.name)
1235
- repo_url = getattr(repo, "html_url", event.repo.url.replace("https://api.github.com/repos/", "https://github.com/"))
1242
+
1243
+ api_prefix = GITHUB_API_URL.rstrip("/") + "/repos/"
1244
+ repo_url = getattr(repo, "html_url", event.repo.url.replace(api_prefix, github_web_base() + "/"))
1236
1245
 
1237
1246
  st += print_v(f"\nRepo name:\t\t\t{repo_name}")
1238
1247
  st += print_v(f"Repo URL:\t\t\t{repo_url}")
@@ -1327,8 +1336,8 @@ def github_print_event(event, g, time_passed=False, ts: datetime | None = None):
1327
1336
  # st += print_v("\n[debug] PushEvent payload has no 'commits' array; using compare API")
1328
1337
  # st += print_v(f"[debug] before:\t\t\t{before_sha}")
1329
1338
  # st += print_v(f"[debug] head/after:\t\t{head_sha}")
1330
- if size_hint is not None:
1331
- st += print_v(f"[debug] size (hint):\t\t{size_hint}")
1339
+ # if size_hint is not None:
1340
+ # st += print_v(f"[debug] size (hint):\t\t{size_hint}")
1332
1341
 
1333
1342
  if before_sha and head_sha and before_sha != head_sha:
1334
1343
  try:
@@ -1341,7 +1350,7 @@ def github_print_event(event, g, time_passed=False, ts: datetime | None = None):
1341
1350
  commits = list(compare.commits)
1342
1351
  commits_total = len(commits)
1343
1352
  short_repo = getattr(repo, "full_name", repo_name)
1344
- compare_url = f"https://github.com/{short_repo}/compare/{before_sha[:12]}...{head_sha[:12]}"
1353
+ compare_url = f"{github_web_base()}/{short_repo}/compare/{before_sha[:12]}...{head_sha[:12]}"
1345
1354
  st += print_v(f"\nNumber of commits:\t\t{commits_total}")
1346
1355
  st += print_v(f"Compare URL:\t\t\t{compare_url}")
1347
1356
 
@@ -1848,9 +1857,11 @@ def handle_profile_change(label, count_old, count_new, list_old, raw_list, user,
1848
1857
  if removed_items:
1849
1858
  print(f"Removed {label.lower()}:\n")
1850
1859
  removed_mbody = f"\nRemoved {label.lower()}:\n\n"
1860
+ web_base = github_web_base()
1851
1861
  for item in removed_items:
1852
- item_url = (f"https://github.com/{item}/" if label.lower() in ["followers", "followings", "starred repos"]
1853
- else f"https://github.com/{user}/{item}/")
1862
+ item_url = (f"{web_base}/{item}/" if label.lower() in ["followers", "followings", "starred repos"]
1863
+ else f"{web_base}/{user}/{item}/")
1864
+
1854
1865
  print(f"- {item} [ {item_url} ]")
1855
1866
  removed_list_str += f"- {item} [ {item_url} ]\n"
1856
1867
  try:
@@ -1863,9 +1874,10 @@ def handle_profile_change(label, count_old, count_new, list_old, raw_list, user,
1863
1874
  if added_items:
1864
1875
  print(f"Added {label.lower()}:\n")
1865
1876
  added_mbody = f"\nAdded {label.lower()}:\n\n"
1877
+ web_base = github_web_base()
1866
1878
  for item in added_items:
1867
- item_url = (f"https://github.com/{item}/" if label.lower() in ["followers", "followings", "starred repos"]
1868
- else f"https://github.com/{user}/{item}/")
1879
+ item_url = (f"{web_base}/{item}/" if label.lower() in ["followers", "followings", "starred repos"]
1880
+ else f"{web_base}/{user}/{item}/")
1869
1881
  print(f"- {item} [ {item_url} ]")
1870
1882
  added_list_str += f"- {item} [ {item_url} ]\n"
1871
1883
  try:
@@ -1937,7 +1949,7 @@ def check_repo_list_changes(count_old, count_new, list_old, list_new, label, rep
1937
1949
  print(f"{removal_text} {label.lower()}:\n")
1938
1950
  removed_mbody = f"\n{removal_text} {label.lower()}:\n\n"
1939
1951
  for item in removed_items:
1940
- item_line = f"- {item} [ https://github.com/{item}/ ]" if label.lower() in ["stargazers", "watchers", "forks"] else f"- {item}"
1952
+ item_line = f"- {item} [ {github_web_base()}/{item}/ ]" if label.lower() in ["stargazers", "watchers", "forks"] else f"- {item}"
1941
1953
  print(item_line)
1942
1954
  removed_list_str += item_line + "\n"
1943
1955
  try:
@@ -1952,7 +1964,7 @@ def check_repo_list_changes(count_old, count_new, list_old, list_new, label, rep
1952
1964
  print(f"Added {label.lower()}:\n")
1953
1965
  added_mbody = f"\nAdded {label.lower()}:\n\n"
1954
1966
  for item in added_items:
1955
- item_line = f"- {item} [ https://github.com/{item}/ ]" if label.lower() in ["stargazers", "watchers", "forks"] else f"- {item}"
1967
+ item_line = f"- {item} [ {github_web_base()}/{item}/ ]" if label.lower() in ["stargazers", "watchers", "forks"] else f"- {item}"
1956
1968
  print(item_line)
1957
1969
  added_list_str += item_line + "\n"
1958
1970
  try:
@@ -1,7 +0,0 @@
1
- github_monitor.py,sha256=OpG9CftmM85d7pJrYhZ2W2Ik3WF3dlDR9TSraJwOmGo,137642
2
- github_monitor-2.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
3
- github_monitor-2.2.dist-info/METADATA,sha256=7K-qKbUhVU5YIgSnlZYlTPwkfhuvS0JHaL1JY6Zalz4,17459
4
- github_monitor-2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- github_monitor-2.2.dist-info/entry_points.txt,sha256=hV03y00u1L16S5BwBSLQvFsZcL2WGRtjzlrmu9U9SN0,55
6
- github_monitor-2.2.dist-info/top_level.txt,sha256=HDN2988ydvH9JZT32PushzqrcD05Q5qg960vgHGIaI8,15
7
- github_monitor-2.2.dist-info/RECORD,,