Skip to content

Commit

Permalink
skip repo if not found. add commented author url check too
Browse files Browse the repository at this point in the history
  • Loading branch information
bamos committed Jul 2, 2024
1 parent e852b0c commit 4d05fd4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,11 @@ def add_repo_data(context, config, in_tex):
# caching to disk.
if short_name not in repo_htmls:
r = requests.get(item['repo_url'])
repo_htmls[short_name] = r.content
if r.status_code == 200:
repo_htmls[short_name] = r.content
else:
print(f"+ Skipping {item['repo_url']} (status code {r.status_code})")
continue
soup = BeautifulSoup(repo_htmls[short_name], 'html.parser')

star_str = soup.find(class_="js-social-count").text.strip()
Expand All @@ -443,6 +447,11 @@ def get_scholar_stats(scholar_id):
scholar_stats['citations'] = truncate_to_k(author['citedby'])
return scholar_stats

def check_author_urls(author_urls_dict):
for author, url in author_urls_dict.items():
r = requests.head(url)
if r.status_code != 200:
print(f"+ URL for {author} ({url}) returned status code {r.status_code}")

class RenderContext(object):
BUILD_DIR = 'build'
Expand Down Expand Up @@ -551,6 +560,7 @@ def render_resume(self, yaml_data):
section_data['scholar_stats'] = get_scholar_stats(yaml_data['social']['google_scholar'])
section_template_name = os.path.join(
self.SECTIONS_DIR, section_tag + self._file_ending)
# check_author_urls(section_content['author_urls'])
elif section_tag == 'NEWPAGE':
pass
else:
Expand Down

0 comments on commit 4d05fd4

Please sign in to comment.