1010
1111from httpx import AsyncClient , BasicAuth , Response
1212
13+ Submission = dict [str , Any ]
14+
1315
1416class ArticlesSortType (Enum ):
1517 """Enum with all viable sorting types"""
@@ -52,7 +54,7 @@ def __init__(
5254
5355 async def subreddit_articles (
5456 self , subreddit : str , limit : int , sort : ArticlesSortType
55- ) -> list [dict [ str , Any ] ]:
57+ ) -> list [Submission ]:
5658 """Get a list of Reddit articles from the given subreddit
5759
5860 Args:
@@ -61,7 +63,7 @@ async def subreddit_articles(
6163 sort (ArticlesSortType): sort type to use when loading articles
6264
6365 Returns:
64- list[dict[str, Any ]: list of loaded articles from the given subreddit
66+ list[Submission ]: list of loaded articles from the given subreddit
6567 """
6668 self ._logger .info (f"Loading subreddit articles [{ subreddit } ] [{ limit } ] [{ sort .name } ]" )
6769 url = self ._SUBREDDIT_ARTICLES_URL .format (subreddit = subreddit , sort = sort .name .lower ())
@@ -70,7 +72,7 @@ async def subreddit_articles(
7072
7173 async def user_articles (
7274 self , user : str , limit : int , sort : ArticlesSortType
73- ) -> list [dict [ str , Any ] ]:
75+ ) -> list [Submission ]:
7476 """Get a list of Reddit articles from the given Reddit user
7577
7678 Args:
@@ -79,7 +81,7 @@ async def user_articles(
7981 sort (ArticlesSortType): sort type to use when loading articles
8082
8183 Returns:
82- list[dict[str, Any ]: list of loaded articles from the Reddit user
84+ list[Submission ]: list of loaded articles from the Reddit user
8385 """
8486 self ._logger .info (f"Loading user articles [{ user } ] [{ limit } ] [{ sort .name } ]" )
8587 url = self ._USER_ARTICLES_URL .format (user = user )
@@ -105,7 +107,7 @@ async def _request_access_token(self) -> Response:
105107 headers = self ._auth_headers ,
106108 )
107109
108- async def _get_articles (self , url : str , params : dict [str , Any ]) -> list [dict [ str , Any ] ]:
110+ async def _get_articles (self , url : str , params : dict [str , Any ]) -> list [Submission ]:
109111 if self ._access_token_expires_in <= time_ns ():
110112 self ._logger .info ("Access token expired, requesting new one" )
111113 await self ._authorize ()
0 commit comments