Как извлечь содержимое файлов из репозитория GitHub?

Есть функция, которая извлекает содержимое файлов из репозитория GitHub, но она извлекает только в случае, если файлы не находятся в папке.

Посдкажите, как можно ивзлечь файлы из папок с помощью моего метода?

async def get_code_from_directory(repo_url: str):
    directory_contents = await get_directory_contents(repo_url)
    code_files = []
    for item in directory_contents:
        if item['type'] == 'file' and item['name'].endswith(('.py', '.java', '.js', '.html', '.css')):
            response = await httpx_client.get(item['download_url'])
            response.raise_for_status()
            code_content = response.text
            code_files.append({item['name']: code_content})
    return code_files 

Ответы (0 шт):