This commit is contained in:
2025-05-18 13:58:13 +03:00
parent 50b0c16048
commit f9dafb795d
2 changed files with 7 additions and 7 deletions

View File

@ -11,7 +11,7 @@ from basethon.async_base_session import AsyncBaseSession
from basethon.proxy_parser import ProxyParser from basethon.proxy_parser import ProxyParser
class JsonAsyncConverter(AsyncBaseSession): class JsonAsyncConverter:
def __init__( def __init__(
self, self,
base_dir: Path, base_dir: Path,
@ -28,7 +28,7 @@ class JsonAsyncConverter(AsyncBaseSession):
proxy: прокси для подключения формат: http:ip:port:user:pswd proxy: прокси для подключения формат: http:ip:port:user:pswd
json_write: записывать в json файл информацию о string_session + proxy? json_write: записывать в json файл информацию о string_session + proxy?
""" """
super().__init__(base_dir, errors_dir, banned_dir) self.__base_session = AsyncBaseSession(base_dir, errors_dir, banned_dir)
self.__api_id, self.__api_hash = 2040, "b18441a1ff607e10a989891a5462e627" self.__api_id, self.__api_hash = 2040, "b18441a1ff607e10a989891a5462e627"
self.__json_write = json_write self.__json_write = json_write
self.__proxy = ProxyParser(proxy).asdict_thon self.__proxy = ProxyParser(proxy).asdict_thon
@ -71,7 +71,7 @@ class JsonAsyncConverter(AsyncBaseSession):
string_session: str string_session: str
proxy: dict proxy: dict
""" """
async for item, json_file, json_data in self: async for item, json_file, json_data in self.__base_session:
_item, _json_file, _json_data = await self._main(item, json_file, json_data) _item, _json_file, _json_data = await self._main(item, json_file, json_data)
yield _item, _json_file, _json_data yield _item, _json_file, _json_data
@ -82,7 +82,7 @@ class JsonAsyncConverter(AsyncBaseSession):
""" """
count = 0 count = 0
self.__json_write = True self.__json_write = True
async for item, json_file, json_data in self: async for item, json_file, json_data in self.__base_session:
await self._main(item, json_file, json_data) await self._main(item, json_file, json_data)
count += 1 count += 1
return count return count

View File

@ -11,7 +11,7 @@ from .base_session import BaseSession
from .proxy_parser import ProxyParser from .proxy_parser import ProxyParser
class JsonConverter(BaseSession): class JsonConverter:
def __init__( def __init__(
self, self,
base_dir: Path, base_dir: Path,
@ -28,7 +28,7 @@ class JsonConverter(BaseSession):
proxy: прокси для подключения формат: http:ip:port:user:pswd proxy: прокси для подключения формат: http:ip:port:user:pswd
json_write: записывать в json файл информацию о string_session + proxy? json_write: записывать в json файл информацию о string_session + proxy?
""" """
super().__init__(base_dir, errors_dir, banned_dir) self.__base_session = BaseSession(base_dir, errors_dir, banned_dir)
self.__api_id, self.__api_hash = 2040, "b18441a1ff607e10a989891a5462e627" self.__api_id, self.__api_hash = 2040, "b18441a1ff607e10a989891a5462e627"
self.__json_write = json_write self.__json_write = json_write
self.__proxy = ProxyParser(proxy).asdict_thon self.__proxy = ProxyParser(proxy).asdict_thon
@ -82,7 +82,7 @@ class JsonConverter(BaseSession):
""" """
count = 0 count = 0
self.__json_write = True self.__json_write = True
for item, json_file, json_data in self: for item, json_file, json_data in self.__base_session:
self._main(item, json_file, json_data) self._main(item, json_file, json_data)
count += 1 count += 1
return count return count