(url)
| 511 | print(f"GitHub API Rate Limit Exceeded: remained - {(g.rate_limiting_resettime - datetime.datetime.now().timestamp())/60:.2f} min") |
| 512 | else: |
| 513 | def renew_stat(url): |
| 514 | if is_rate_limit_exceeded(): |
| 515 | return |
| 516 | |
| 517 | if 'github.com' not in url: |
| 518 | return None |
| 519 | |
| 520 | print('.', end="") |
| 521 | sys.stdout.flush() |
| 522 | try: |
| 523 | # Parsing the URL |
| 524 | parsed_url = urlparse(url) |
| 525 | domain = parsed_url.netloc |
| 526 | path = parsed_url.path |
| 527 | path_parts = path.strip("/").split("/") |
| 528 | if len(path_parts) >= 2 and domain == "github.com": |
| 529 | owner_repo = "/".join(path_parts[-2:]) |
| 530 | repo = g.get_repo(owner_repo) |
| 531 | owner = repo.owner |
| 532 | now = datetime.datetime.now(datetime.timezone.utc) |
| 533 | author_time_diff = now - owner.created_at |
| 534 | |
| 535 | last_update = repo.pushed_at.strftime("%Y-%m-%d %H:%M:%S") if repo.pushed_at else 'N/A' |
| 536 | item = { |
| 537 | "stars": repo.stargazers_count, |
| 538 | "last_update": last_update, |
| 539 | "cached_time": now.timestamp(), |
| 540 | "author_account_age_days": author_time_diff.days, |
| 541 | } |
| 542 | return url, item |
| 543 | else: |
| 544 | print(f"\nInvalid URL format for GitHub repository: {url}\n") |
| 545 | except Exception as e: |
| 546 | print(f"\nERROR on {url}\n{e}") |
| 547 | |
| 548 | return None |
| 549 | |
| 550 | # resolve unresolved urls |
| 551 | with concurrent.futures.ThreadPoolExecutor(11) as executor: |
nothing calls this directly
no test coverage detected