Section | Description |
---|---|
Project Description | Overview of the project and its features |
Technologies Used | List of technologies utilized in the project |
Features | Functionalities provided by the system |
API Requests | API endpoint details for IMEI checking |
How to Run the Project | Steps to set up and run the project |
Testing | Instructions for running tests and linting |
Project Structure | Folder structure explanation |
Usage Presentation | Presentation of bot and API usage |
Contacts | Developer contact information |
This project is a backend system built with FastAPI, integrated with a Telegram bot (aiogram
), designed for checking IMEI numbers of devices.
The system allows:
- π Checking IMEI numbers via a Telegram bot.
- π Restricting access via a whitelist of authorized users.
- π Authenticating API requests using tokens.
- π οΈ Using PostgreSQL for data storage and Redis for caching.
- π³ Running with Docker & docker-compose.
- β Testing with Pytest, Tox and linting with Ruff.
- β Whitelist for Telegram users β Only approved users can interact with the bot.
- β Token-based API authentication β Only authorized requests can access the system.
- π‘ User sends an IMEI number to the bot.
- π‘οΈ The bot validates the IMEI.
- π The bot returns device information.
πΉ Request Parameters:
{
"imei": "123456789012345",
"token": "your_auth_token"
}
πΉ Response Example:
{
"id": "QlMEbz_nPPy4JkzW",
"type": "api",
"status": "successful",
"orderId": null,
"service": {
"id": 12,
"title": "Mock service with only successful results"
},
"amount": "0.00",
"deviceId": "860479069365109",
"processedAt": 1738168765,
"properties": {
"deviceName": "iPhone 13 Pro Max 256GB Gold [A2484] [iPhone14,3]",
"image": "https://sources.imeicheck.net/images/5f8fce1d71ce09f9c773a51568971316.png",
"imei": "860479069365109",
"meid": "86047906936510",
"imei2": "566392068297521",
"serial": "OA1TPDDDVAXAF",
"estPurchaseDate": 1712368292,
"additional_data": {
"replaced": false,
"repairCoverage": false,
"technicalSupport": false,
"modelDesc": "SVC IPHONE 11 PRO MAX NA 64G GRY CI/AR",
"replacement": false,
"refurbished": false,
"apple/modelName": "iPhone 13 Pro Max",
"fmiOn": false,
"lostMode": true,
"usaBlockStatus": "Reported stolen by AT&T MOBILITY"
}
}
}
π API uses the service imeicheck.net.
π οΈ Sandbox API Token: e4oEaZY1Kom5OXzybETkMlwjOCy3i8GSCGTHzWrhd4dc563b
git clone https://github.com/arielen/test_Hatiko_tech.git
cd test_Hatiko_tech
Create an .env
file based on .env.example
:
cp .env.example .env
Fill in environment variables (PostgreSQL, Redis, API Token, etc.).
docker-compose up --build
π The project will start in containers:
FastAPI
athttp://localhost:8000
PostgreSQL
atlocalhost:5432
Redis
atlocalhost:6379
tox # for run all tests
# tox -e lint # for check lint and codestyle
# tox -e py313 # for run tests
pytest tests
ruff check .
π imei-bot/
βββ π bot/ # TG Bot
β βββ π database/ # Database models and queries
β βββ π enums/ # Enum definitions for bot settings
β βββ π handlers/ # Handlers for bot commands and callbacks
β βββ π keyboards/ # Keyboard markup configurations for bot UI
β βββ π locales/ # Localization files for multi-language support
β βββ bot.py # Main bot initialization and event loop
β βββ config.py # Bot configuration and settings
β βββ signals.py # Signal handling for bot events
βββ π src/ # API
β βββ π api/ # FastAPI endpoints
β βββ π core/ # Configuration
β βββ π schemas/ # Pydantic schemas
β βββ π services/ # IMEI checking logic
β βββ main.py # FastAPI entry point
βββ π tests/ # Pytest tests
βββ .env.example # Example environment variables
βββ docker-compose.yml # Docker Compose configuration
βββ Dockerfile.api # Dockerfile for run API
βββ Dockerfile.bot # Dockerfile for run TG Bot
βββ pyproject.toml # Configuration for ruff & pytest
βββ tox.ini # Tox configuration
βββ requirements-api.txt # Python dependencies API
βββ requirements-bot.txt # Python dependencies TG Bot
βββ requirements-test.txt # Python dependencies for tests
βββ README.md # Project documentation
bot_present.mp4
api_present.mp4
π» Developer: arielen
π§ Email: pavlov_zv@mail.ru
π§ TG: 1 0