From 2d1235f4ad12be6975db28464475745c1058d486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=A0=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Thu, 21 May 2026 14:11:56 +0000 Subject: [PATCH] Add main.py --- main.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..4a86bd5 --- /dev/null +++ b/main.py @@ -0,0 +1,31 @@ +import requests + + +def list_repos(username): + """Return a list of repositories for the given username using GitHub API.""" + url = f"https://api.github.com/users/{username}/repos" + repos = [] + page = 1 + per_page = 100 + while True: + resp = requests.get(url, params={"per_page": per_page, "page": page}) + if resp.status_code != 200: + print(f"Error fetching repos: {resp.status_code}") + break + data = resp.json() + if not data: + break + repos.extend(data) + page += 1 + return repos + + +def main(): + username = "RK-A" + repos = list_repos(username) + for r in repos: + print(f"{r['full_name']}: {r['html_url']}") + + +if __name__ == "__main__": + main()