2020import genanki # type: ignore
2121
2222# https://github.com/prius/python-leetcode
23- import leetcode # type: ignore
23+ import leetcode .api .default_api # type: ignore
24+ import leetcode .api_client # type: ignore
2425import leetcode .auth # type: ignore
26+ import leetcode .configuration # type: ignore
27+ import leetcode .models .graphql_query # type: ignore
28+ import leetcode .models .graphql_query_variables # type: ignore
2529import urllib3 # type: ignore
2630from tqdm import tqdm # type: ignore
2731
@@ -110,7 +114,7 @@ async def _get_problem_data(self, problem_slug: str) -> Dict[str, str]:
110114
111115 api_instance = self ._api_instance
112116
113- graphql_request = leetcode .GraphqlQuery (
117+ graphql_request = leetcode .models . graphql_query . GraphqlQuery (
114118 query = """
115119 query getQuestionDetail($titleSlug: String!) {
116120 question(titleSlug: $titleSlug) {
@@ -168,7 +172,9 @@ async def _get_problem_data(self, problem_slug: str) -> Dict[str, str]:
168172 }
169173 }
170174 """ ,
171- variables = leetcode .GraphqlQueryVariables (title_slug = problem_slug ),
175+ variables = leetcode .models .graphql_query_variables .GraphqlQueryVariables (
176+ title_slug = problem_slug
177+ ),
172178 operation_name = "getQuestionDetail" ,
173179 )
174180
@@ -300,14 +306,14 @@ def guid(self):
300306
301307
302308@lru_cache (None )
303- def get_leetcode_api_client () -> leetcode .DefaultApi :
309+ def get_leetcode_api_client () -> leetcode .api . default_api . DefaultApi :
304310 """
305311 Leetcode API instance constructor.
306312
307313 This is a singleton, because we don't need to create a separate client
308314 each time
309315 """
310- configuration = leetcode .Configuration ()
316+ configuration = leetcode .configuration . Configuration ()
311317
312318 session_id = os .environ ["LEETCODE_SESSION_ID" ]
313319 csrf_token = leetcode .auth .get_csrf_cookie (session_id )
@@ -317,7 +323,9 @@ def get_leetcode_api_client() -> leetcode.DefaultApi:
317323 configuration .api_key ["LEETCODE_SESSION" ] = session_id
318324 configuration .api_key ["Referer" ] = "https://leetcode.com"
319325 configuration .debug = False
320- api_instance = leetcode .DefaultApi (leetcode .ApiClient (configuration ))
326+ api_instance = leetcode .api .default_api .DefaultApi (
327+ leetcode .api_client .ApiClient (configuration )
328+ )
321329
322330 return api_instance
323331
0 commit comments