1010
1111from httpx import AsyncClient , BasicAuth , Response
1212
13- Submission = dict [str , Any ]
13+ Article = dict [str , Any ]
1414
1515
1616class ArticlesSortType (Enum ):
@@ -54,7 +54,7 @@ def __init__(
5454
5555 async def subreddit_articles (
5656 self , subreddit : str , limit : int , sort : ArticlesSortType
57- ) -> list [Submission ]:
57+ ) -> list [Article ]:
5858 """Get a list of Reddit articles from the given subreddit
5959
6060 Args:
@@ -63,16 +63,14 @@ async def subreddit_articles(
6363 sort (ArticlesSortType): sort type to use when loading articles
6464
6565 Returns:
66- list[Submission ]: list of loaded articles from the given subreddit
66+ list[Article ]: list of loaded articles from the given subreddit
6767 """
6868 self ._logger .info (f"Loading subreddit articles [{ subreddit } ] [{ limit } ] [{ sort .name } ]" )
6969 url = self ._SUBREDDIT_ARTICLES_URL .format (subreddit = subreddit , sort = sort .name .lower ())
7070 params = {"limit" : limit }
7171 return await self ._get_articles (url , params )
7272
73- async def user_articles (
74- self , user : str , limit : int , sort : ArticlesSortType
75- ) -> list [Submission ]:
73+ async def user_articles (self , user : str , limit : int , sort : ArticlesSortType ) -> list [Article ]:
7674 """Get a list of Reddit articles from the given Reddit user
7775
7876 Args:
@@ -81,7 +79,7 @@ async def user_articles(
8179 sort (ArticlesSortType): sort type to use when loading articles
8280
8381 Returns:
84- list[Submission ]: list of loaded articles from the Reddit user
82+ list[Article ]: list of loaded articles from the Reddit user
8583 """
8684 self ._logger .info (f"Loading user articles [{ user } ] [{ limit } ] [{ sort .name } ]" )
8785 url = self ._USER_ARTICLES_URL .format (user = user )
@@ -107,7 +105,7 @@ async def _request_access_token(self) -> Response:
107105 headers = self ._auth_headers ,
108106 )
109107
110- async def _get_articles (self , url : str , params : dict [str , Any ]) -> list [Submission ]:
108+ async def _get_articles (self , url : str , params : dict [str , Any ]) -> list [Article ]:
111109 if self ._access_token_expires_in <= time_ns ():
112110 self ._logger .info ("Access token expired, requesting new one" )
113111 await self ._authorize ()
0 commit comments