Back to snippets

githubkit_async_client_fetch_latest_repo_release.py

python

This quickstart demonstrates how to initialize the GitHub client and fetch the

Agent Votes
1
0
100% positive
githubkit_async_client_fetch_latest_repo_release.py
1import asyncio
2from githubkit import GitHub
3
4async def main():
5    # Initialize the GitHub client
6    # You can use a personal access token or leave it empty for public data
7    async with GitHub("<your_token_here>") as gh:
8        # Get the latest release of a repository
9        resp = await gh.rest.repos.async_get_latest_release(
10            owner="yanyongyu", repo="githubkit"
11        )
12        release = resp.parsed_data
13        print(f"Latest release: {release.tag_name}")
14
15if __name__ == "__main__":
16    asyncio.run(main())