8000 GitHub - arielen/test_Hatiko_tech
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

arielen/test_Hatiko_tech

Repository files navigation

πŸ‘₯ IMEI Check Telegram Bot

Table of Contents

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

πŸš€ Project Description

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.

βš™οΈ Technologies Used

  • Backend: Python 3.13 FastAPI
  • Database: PostgreSQL
  • Cache & Messaging: Redis
  • Telegram Bot: Aiogram
  • Testing & CI/CD: GitHub Actions Tox Pytest Ruff
  • Deployment: Docker & Docker Compose

πŸ“Œ Features

πŸ”‘ 1. Access Control

  • βœ… Whitelist for Telegram users – Only approved users can interact with the bot.
  • βœ… Token-based API authentication – Only authorized requests can access the system.

πŸ€– 2. Telegram Bot Functionality

  • 🎑 User sends an IMEI number to the bot.
  • πŸ›‘οΈ The bot validates the IMEI.
  • πŸ“Š The bot returns device information.

πŸ”— 3. API Requests

🎑 Endpoint: POST /api/check-imei

πŸ”Ή 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


πŸ› οΈ How to Run the Project

πŸ”Ή 1. Clone the Repository

git clone https://github.com/arielen/test_Hatiko_tech.git
cd test_Hatiko_tech

πŸ”Ή 2. Configure Environment Variables

Create an .env file based on .env.example:

cp .env.example .env

Fill in environment variables (PostgreSQL, Redis, API Token, etc.).

πŸ”Ή 3. Run with Docker

docker-compose up --build

πŸ‘‰ The project will start in containers:

  • FastAPI at http://localhost:8000
  • PostgreSQL at localhost:5432
  • Redis at localhost:6379

βœ… Testing

πŸ”Ή Run tox for tests and linting

tox             # for run all tests
# tox -e lint   # for check lint and codestyle
# tox -e py313  # for run tests

πŸ”Ή Run pytest

pytest tests

πŸ”Ή Check code quality with ruff lint

ruff check .

πŸ“œ Project Structure

πŸ“‚ 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

πŸŽ₯ Usage presentation

bot_present.mp4
api_present.mp4

πŸ“ž Contacts

πŸ’» Developer: arielen
πŸ“§ Email: pavlov_zv@mail.ru
πŸ“§ TG: 1 0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0