@botsgram_cu · Post #3076 · 17.10.2020 г., 15:31
¿Que puede hacer este bot? @RenameArchive_bot Con este bot podrás renombrar archivos de Telegram Idioma: inglés (Visto en @botsgram_cu) #renombrar#archivos
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #397 · 12 ное.
Использование Pydantic сегодня стало нормой, и это правильно. Но иногда на ревью вижу, что используют его не всегда корректно. Например, метод BaseModel.model_dump() по умолчанию не преобразует стандартные типы, такие как datetime, UUID или Decimal, в простой сериализуемый для JSON вид. Тогда пишут кастмоный сериализатор для этих типов чтобы функция json.dump() не падала с ошибкой. import uuid from datetime import datetime from decimal import Decimal from uuid import UUID from pydantic import BaseModel class MyModel(BaseModel): id: UUID date: datetime value: Decimal obj = MyModel( id=uuid.uuid4(), date=datetime.now(), value='1.23' ) print(obj.model_dump()) # не подходит для json.dump # { # 'id': UUID('4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1'), # 'date': datetime.datetime(2025, 12, 12, 12, 12, 12, 111111), # 'value': Decimal('1.23') # } # добавляем свой кастомный сериализатор json.dumps(obj.model_dump(), cls=MySerializer) # { # 'id': '4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1', # 'date': '2025-12-12T12:12:12.111111', # 'value': '1.23' # } В данном случае класс MySerializer обрабатывает datetime, UUID и Decimal. Например так: class MySerializer(json.JSONEncoder): def default(self, o): if isinstance(o, Decimal): return str(o) elif isinstance(o, datetime): return o.isoformat() elif isinstance(o, UUID): return str(o) return super().default(o) Специально для тех, кто всё еще так делает - в этом нет необходимости! Pydantic может это сделать сам, просто нужно добавить параметр mode="json". json.dumps(obj.model_dump(mode="json")) # { # 'id': '4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1', # 'date': '2012-12-12T12:12:12.111111', # 'value': '1.23' # } #pydantic#libs
Пребарај: #archivos
@botsgram_cu · Post #3076 · 17.10.2020 г., 15:31
¿Que puede hacer este bot? @RenameArchive_bot Con este bot podrás renombrar archivos de Telegram Idioma: inglés (Visto en @botsgram_cu) #renombrar#archivos
Hashtags
@botsgram_cu · Post #4272 · 21.08.2021 г., 17:26
¿Que puede hacer este bot? @uploadgrammebot Este es el bot oficial de uploadgram.me ¡Envíale un archivo y te dará su enlace directo de descarga! Idioma: inglés (Visto en @botsgram_cu) #enlaces#descarga#archivos
@botsgram_cu · Post #2998 · 06.09.2020 г., 20:06
¿Que puede hacer este bot? @filestolinkebot Este bot puede convertir archivos a enlaces Idiomas: inglés (visto en @botsgram_cu) #enlaces#archivos#descarga
@botsgram_cu · Post #4335 · 05.09.2021 г., 13:58
¿Que puede hacer este bot? @DegooUploaderBot Con este bot puede cargar archivos de Telegram y enlaces de descarga directa a su almacenamiento en la nube degoo. Idiomas: inglés (Visto en @botsgram_cu) #archivos#degoo
@botsgram_cu · Post #4419 · 09.10.2021 г., 11:01
¿Que puede hacer este bot? @Tgfilestore_bot Almacene y comparta archivos con URL permanente. Idiomas: inglés (Visto en @botsgram_cu) #enlaces#archivos#nube
@botsgram_cu · Post #3759 · 02.04.2021 г., 15:06
¿Que puede hacer este bot? @UnzipRobot Extrae archivos comprimidos dentro de Telegram con soporte permanente de miniaturas. Idiomas: Inglés (Visto en @botsgram_cu) #unzip#archivos#enlaces
@botsgram_cu · Post #3073 · 17.10.2020 г., 00:27
¿Que puede hacer este bot? @cloudy_files_bot Este es un bot de servicio en la nube. Le permite administrar archivos y descargarlos. Idiomas: inglés (Visto en @botsgram_cu) #descargas#nube#archivos
Hashtags
@botsgram_cu · Post #2961 · 12.08.2020 г., 01:29
¿Que puede hacer este bot? @tg_renamer_bot Este es un bot de cambio de nombre de archivo de telegram personalizado, con soporte de miniatura Idiomas: inglés (visto en @botsgram_cu) #archivos#renombrar#miniaturas
Hashtags
@botsgram_cu · Post #4992 · 28.04.2024 г., 21:33
¿Qué puede hacer este bot? @complete_pdf_bot Si eres alguien que pasa mucho tiempo trabajando con archivos PDF de Telegram, 𝐈 💔 𝐏𝐃𝐅 es una herramienta imprescindible. Este bot simplifica a los usuarios convertir archivos hacia y desde formato PDF, editar, fusionar, dividir, comprimir e incluso convertir imágenes a PDF o viceversa. #pdf#imagenes#archivos (Visto en @BotsGram_Cu)
@botsgram_cu · Post #4971 · 10.04.2024 г., 21:59
¿Qué puede hacer este bot? @FILEs_COMPRESSOR_BOT Este bot le permite comprimir archivos en archivos zip y administrarlos. Idioma: Inglés #archivos#compresion#zip (Visto en @BotsGram_Cu)
Hashtags
@botsgram_cu · Post #4490 · 16.11.2021 г., 22:22
@TG_UnZipperBot ¿Qué puede hacer este bot? Extrae archivos zip, tar, 7z, tar.xz, etc Idioma: Inglés 🇬🇧 (Visto en @BotsGram_cu) #unzip#extraer#archivos
@botsgram_cu · Post #4250 · 16.08.2021 г., 18:26
¿Que puede hacer este bot? @TheFileShareBot Guarde y comparta archivos, obtenga un enlace permanente de Telegram. Idiomas: inglés turco (Visto en @botsgram_cu) #archivos#herramientas#compartir#anónimo