1212class HowLongToBeat :
1313 """
1414 Main class that contain the base "search" function
15- The search function is available using standard request or using an async request that MUST be awaited
15+ The search function is available using standard request
16+ Or using an async request, remember that request MUST be awaited
1617 """
1718
1819 # ------------------------------------------
@@ -73,7 +74,7 @@ async def async_search_from_id(self, game_id: int):
7374 """
7475 Function that search the game using an async request
7576 To re-use code, I extract the game name and search game by name, picking only the game with the same id
76- Remember that this function use 2 requests : one to get the game title and one to get game data
77+ Remember that this function use one extra request : one to get the game title and one to get game data
7778 @param game_id: The game id to get data
7879 @return: The game data (single HowLongToBeatEntry object) or None in case of error
7980 """
@@ -84,7 +85,7 @@ async def async_search_from_id(self, game_id: int):
8485 html_result = await HTMLRequests .send_async_web_request (game_title )
8586 if html_result is not None :
8687 result_list = self .__parse_web_result (game_title , html_result , game_id )
87- if result_list is None or len (result_list ) == 0 or len ( result_list ) > 1 :
88+ if result_list is None or len (result_list ) != 1 :
8889 return None
8990 return result_list [0 ]
9091 return None
@@ -93,7 +94,7 @@ async def async_search_from_id(self, game_id: int):
9394 def search_from_id (self , game_id : int ):
9495 """
9596 To re-use code, I extract the game name and search game by name, picking only the game with the same id
96- Remember that this function use 2 requests : one to get the game title and one to get game data
97+ Remember that this function use use one extra request : one to get the game title and one to get game data
9798 @param game_id: The game id to get data
9899 @return: The game data (single HowLongToBeatEntry object) None in case of error
99100 """
@@ -104,7 +105,7 @@ def search_from_id(self, game_id: int):
104105 html_result = HTMLRequests .send_web_request (game_title )
105106 if html_result is not None :
106107 result_list = self .__parse_web_result (game_title , html_result , game_id )
107- if result_list is None or len (result_list ) == 0 or len ( result_list ) > 1 :
108+ if result_list is None or len (result_list ) != 1 :
108109 return None
109110 return result_list [0 ]
110111 return None
0 commit comments