Skip to content

Commit 20cea18

Browse files
authored
Update to v0.9.3
1 parent 2c9d690 commit 20cea18

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = pnu-libgh
33
description = GitHub scraping library and tool
44
long_description = file: README.md
55
long_description_content_type = text/markdown
6-
version = 0.9.2
6+
version = 0.9.3
77
license = BSD 3-Clause License
88
license_files = LICENSe
99
author = Hubert Tournier

src/libgh/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from .libpnu2 import get_url_bdata, get_url_data, prune_cache, collection2xml
2020

2121
# Version string used by the what(1) and ident(1) commands:
22-
ID = "@(#) $Id: libgh - GitHub scraping tool v0.9.2 (May 19, 2024) by Hubert Tournier $"
22+
ID = "@(#) $Id: libgh - GitHub scraping tool v0.9.3 (May 22, 2024) by Hubert Tournier $"
2323

2424
# Default parameters. Can be overcome by environment variables, then command line options
2525
parameters = {

src/libgh/personal_account.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -294,18 +294,21 @@ def load_user_account(account_name, soup, cache_days, force_fetch=False, complet
294294
# repositories
295295
account["repositories"] = {}
296296
html = soup.select_one('[data-tab-item="repositories"]')
297-
try:
298-
account["repositories_count"] = int([x.strip() for x in html.text.split("\n") if x][-1])
299-
except ValueError:
297+
if html is not None:
298+
try:
299+
account["repositories_count"] = int([x.strip() for x in html.text.split("\n") if x][-1])
300+
except ValueError:
301+
account["repositories_count"] = 0
302+
account["repositories"] = load_user_repositories(
303+
account_name,
304+
f"{GITHUB_URL}/{account_name}?tab=repositories",
305+
1,
306+
cache_days,
307+
force_fetch=force_fetch,
308+
complete=complete
309+
)
310+
else:
300311
account["repositories_count"] = 0
301-
account["repositories"] = load_user_repositories(
302-
account_name,
303-
f"{GITHUB_URL}/{account_name}?tab=repositories",
304-
1,
305-
cache_days,
306-
force_fetch=force_fetch,
307-
complete=complete
308-
)
309312

310313
# repositories stars (computed)
311314
stars = 0
@@ -316,9 +319,12 @@ def load_user_account(account_name, soup, cache_days, force_fetch=False, complet
316319
# stars
317320
account["stars"] = {}
318321
html = soup.select_one('[data-tab-item="stars"]')
319-
try:
320-
account["stars_count"] = int([x.strip() for x in html.text.split("\n") if x][-1])
321-
except ValueError:
322+
if html is not None:
323+
try:
324+
account["stars_count"] = int([x.strip() for x in html.text.split("\n") if x][-1])
325+
except ValueError:
326+
account["stars_count"] = 0
327+
else:
322328
account["stars_count"] = 0
323329

324330
# sponsoring

0 commit comments

Comments
 (0)