fixed if item and jsonfile renamed
This commit is contained in:
@ -37,10 +37,12 @@ class JsonConverter(BaseSession):
|
||||
self.__json_write, self.__rename = json_write, rename
|
||||
self.__proxy = ProxyParser(proxy).asdict_thon
|
||||
|
||||
def _main(self, item: Path, json_file: Path, json_data: dict) -> dict:
|
||||
def _main(
|
||||
self, item: Path, json_file: Path, json_data: dict
|
||||
) -> tuple[Path, Path, dict]:
|
||||
"""
|
||||
Конвертация сессии в json (string_session)
|
||||
Возвращает json_data с добавленными proxy и string_session
|
||||
Возвращает кортеж (item, json_file, json_data)
|
||||
"""
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
@ -70,7 +72,7 @@ class JsonConverter(BaseSession):
|
||||
json_write_sync(json_file, json_data)
|
||||
if self.__json_write:
|
||||
json_write_sync(json_file, json_data)
|
||||
return json_data
|
||||
return item, json_file, json_data
|
||||
|
||||
def iter(self) -> Generator:
|
||||
"""
|
||||
@ -81,8 +83,8 @@ class JsonConverter(BaseSession):
|
||||
proxy: dict
|
||||
"""
|
||||
for item, json_file, json_data in self.iter_sessions():
|
||||
_json_data = self._main(item, json_file, json_data)
|
||||
yield item, json_file, _json_data
|
||||
_item, _json_file, _json_data = self._main(item, json_file, json_data)
|
||||
yield _item, _json_file, _json_data
|
||||
|
||||
def main(self) -> int:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user