Enhance debug_request function to include additional repository details and add placeholder for README build logic

This commit is contained in:
2026-02-28 13:14:03 +00:00
parent 9871f2d47f
commit a408e9990c

View File

@@ -17,8 +17,10 @@ def do_request(url, headers=None):
print(f"Request failed: {e}")
return None
def do_readme_build():
pass # Placeholder for the actual README build logic
# a simple function to test the API connection and print some debug information, this will be used for debugging purposes to ensure that the API connection is working correctly and to see what data is being returned from the API calls.
def debug_request():
headers = {"Authorization": f"token {GITEA_TOKEN}"}
version_info = do_request(f"{GITEA_URL}/api/v1/version", headers=headers)
@@ -32,6 +34,15 @@ def debug_request():
repos = do_request(f"{GITEA_URL}/api/v1/users/{USERNAME}/repos?type=owner", headers=headers)
if repos is not None:
print(f"Number of repos for user '{USERNAME}': {len(repos)}")
for repo in repos:
print(f"Repo Name: {repo.get('name', 'N/A')}, Repo ID: {repo.get('id', 'N/A')}")
if repo.get("has_code", False):
print(f"Repo '{repo.get('name', 'N/A')}' has code.")
print(f"Repo '{repo.get('name', 'N/A')}' is private: {repo.get('private', 'N/A')}")
print(f"Repo '{repo.get('name', 'N/A')}' is archived: {repo.get('archived', 'N/A')}")
print(f"Repo '{repo.get('name', 'N/A')}' has language: {repo.get('language', 'N/A')}")
print(f"Repo '{repo.get('name', 'N/A')}' has size: {repo.get('size', 'N/A')} KB")
except Exception:
print("\n" + "!"*30)
print("STACK TRACE (Line Numbers):")