@@ -31,10 +31,10 @@ GITHUB_TOKEN=your_github_token_here
3131
3232``` py
3333import asyncio
34- from asyncpygithub import User
34+ from asyncPyGithub import GitHubUserPortal
3535
3636async def main ():
37- status, user = await User .authenticate()
37+ status, user = await GitHubUserPortal .authenticate()
3838 if status == 200 :
3939 print (f " Hello, { user.login} ! " )
4040 else :
@@ -50,25 +50,30 @@ Calling multiple methods with little to no overlap benefit greatly from concurre
5050For example, we can call these (3) methods one by one:
5151
5252``` py
53- from asyncpygithub import User
53+ from asyncPyGithub import GitHubUserPortal
5454
5555async def one_by_one_example () ->None :
56- await User .get_by_id( ... )
57- await User .get_by_username( ... )
58- await User .all( ... )
59-
56+ await GitHubUserPortal .get_by_id( ... )
57+ await GitHubUserPortal .get_by_username( ... )
58+ await GitHubUserPortal .all( ... )
59+
6060 ...
6161```
6262
6363However, this is no better than the synchronous equivalent.
6464To get the full benefits, we can use ` asyncio.gather ` like so:
6565
6666``` py
67+ from asyncPyGithub import GitHubUserPortal
68+
6769async def async_gathered_example () -> None :
68- awaitables:list[CoroutineType[Any, Any, UserQueryReturnable]] = (
69- User .get_by_id( ... )
70- User .get_by_username( ... )
71- User .all( ... )
72- )
70+ awaitables: list[CoroutineType[Any, Any, UserQueryReturnable]] = [
71+ GitHubUserPortal .get_by_id( ... ),
72+ GitHubUserPortal .get_by_username( ... ),
73+ GitHubUserPortal .all( ... ),
74+ ]
7375 results = await asyncio.gather(* awaitables)
76+
77+ ...
7478```
79+
0 commit comments