Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Pure declarative Telegram Bot API and implementation with pydantic models and sync and async API Protocol.
Pure declarative Telegram Bot API and implementation with Pydantic models and Protocol-based API definitions (both sync and async) with neat typehints and docstrings, generated directly from Telegram website docs, parser/generator is included.
Get tired of dozens telegram libs with strange json-parsing stuff and a bunch of unnecessary bells and whistles? Me too, so please meet N+1th one.
No helpers, no handlers, no batteries included, only pure API models, pydantic-based, which, I believe, is golden standard for json parsing/converting now, abstract API protocols, fully typed and documented with well-formatted docstrings, and just few of lines of python magic to make it work with any of requests-like library, httpx implementation both sync and async is included as extra.
pydantic
models for all of Telegram API objects.pydantic
v1/v2.requests
-like lib, httpx
-based implementation is included, both sync and async.files=
parameter of underlying lib).To install with ready to use httpx
-based implementation type
pip install pure-teleapi[httpx]
To install with no external dependencies (except pydantic
)
pip install pure-teleapi
In this case it's a must to provide underlying transport, it's easy, just check teleapi/httpx_transport.py.
from teleapi.httpx_transport import httpx_teleapi_factory
bot = httpx_teleapi_factory("<BOT_TOKEN>", timeout=60)
offset = 0
while True:
print("Waiting for updates...")
updates = bot.getUpdates(offset=offset, timeout=50)
for update in updates:
bot.sendMessage(
chat_id=update.message.chat.id,
text="Yes " + (update.message.text or "??"),
)
offset = update.update_id + 1
If this lib becomes outdated, one can parse and generate updated version easily.
Clone repo, then type poetry install --with dev --all-extras
and just run apigen/main.py.
teleapi.py
will appear in .generated
dir, check then copy it to teleapi
package.
Because docs are human readable, some sort of adoptions in parser may be necessary.
Most difficulties are in parsing return type of the methods,
so please check apigen.models.ApiType.parse_return_type()
method.
FAQs
Pure declarative Telegram Bot API and implementation with pydantic models and sync and async API Protocol.
We found that pure-teleapi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.