Skip to content

Instantly share code, notes, and snippets.

View dantetemplar's full-sized avatar

Ruslan Bel'kov dantetemplar

View GitHub Profile
@dantetemplar
dantetemplar / telegram_authorization.py
Last active February 17, 2025 21:49
Check Telegram WebAppData and LoginWidgetData in Python with FastAPI
"""
Check Telegram WebAppData and LoginWidgetData in Python with FastAPI.
Source: https://gist.github.com/dantetemplar/68e09e3674bf6ce72e23b89b2091d159
License: MIT License
Author: Ruslan Belkov
"""
import hashlib
import hmac
@dantetemplar
dantetemplar / 2.README-GIST.md
Last active March 15, 2024 11:50
Aiogram 3 log messages and handlers

Aiogram 3 log messages and handlers

Warning

Tested on aiogram=3.3.0, code may failed with another version as it uses tricky things

Features

изображение

Automatically log every action from user

Each user action will be displayed in a log stream with the appropriate type (Message, CallbackQuery and so on).

@dantetemplar
dantetemplar / 1.README-GIST.md
Last active December 5, 2024 19:33
Async alembic configuration

Async alembic configuration

Features

Database connection from settings.yaml

You don't need to change alembic.ini to set up a database connection. Alembic will derive database connection uri from settings.yaml (or any yaml which you specify in SETTINGS_PATH environment variable).

Example of settings.yaml: