diff --git a/pybotx/bot/bot.py b/pybotx/bot/bot.py index 359dee6d..4087d1a8 100644 --- a/pybotx/bot/bot.py +++ b/pybotx/bot/bot.py @@ -16,7 +16,7 @@ from uuid import UUID import httpx -from aiofiles.tempfile import NamedTemporaryFile +from aiofiles.tempfile import SpooledTemporaryFile from pydantic import ValidationError, parse_obj_as from pybotx.async_buffer import AsyncBufferReadable, AsyncBufferWritable @@ -170,7 +170,7 @@ BotXAPIUsersAsCSVRequestPayload, UsersAsCSVMethod, ) -from pybotx.constants import BOTX_DEFAULT_TIMEOUT, STICKER_PACKS_PER_PAGE +from pybotx.constants import BOTX_DEFAULT_TIMEOUT, CHUNK_SIZE, STICKER_PACKS_PER_PAGE from pybotx.converters import optional_sequence_to_list from pybotx.image_validators import ( ensure_file_content_is_png, @@ -1243,7 +1243,7 @@ async def users_as_csv( botx=botx, ) - async with NamedTemporaryFile("w+") as async_buffer: + async with SpooledTemporaryFile(max_size=CHUNK_SIZE, mode="w+") as async_buffer: yield ( BotXAPIUserFromCSVResult(**row).to_domain() async for row in await method.execute(payload, async_buffer) diff --git a/pyproject.toml b/pyproject.toml index 4bbd1a40..99f57b51 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pybotx" -version = "0.51.1" +version = "0.51.2" description = "A python library for interacting with eXpress BotX API" authors = [ "Sidnev Nikolay ",