Skip to content

ZhannaVen/homework_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HomeworkBot - is your bot-assistant

Description

Telegram-bot accesses the Ya.Praktikum.Homework API and finds out the status of your homework. There are three statuses:

  • reviewing (is being reviewed);
  • approved (has been checked and accepted);
  • rejected (has been checked and needed improvement).

What does Bot do?

  • Bot sends a request to the Ya.Practicum.Homework API service and receives the status of the homework sent for review every 10 minutes;
  • upon updating the status, Bot analyzes the API response and sends you a corresponding notification to your Telegram chat;
  • Bot logs its work and informs you about important problems with a message to your Telegram chat.

Where requests are sent?

Template for .env file

  • PRACTICUM_TOKEN: secret token for access to Ya.Practicum, that only students have
  • TELEGRAM_TOKEN: secret token of your telegram bot
  • TELEGRAM_CHAT_ID: id of the chat where you want to forward a messadge of a homework status

Where telegram_chat_id and telegram_token can be found?

  • Telegram_chat_id: find @userinfobot, send any message (or resend someone's else message) and Bot will reply you with chat_id;
  • Telegram_token: find @BotFather, create your own Bot by following the instructions and then request the secret token of your Bot.

How to run a project (Unix)

  • Clone the repository
git clone git@github.com:ZhannaVen/homework_bot.git
  • Install and activate the virtual environment (requires python version >= 3.7):
py -3.7 -m venv venv
source venv/bin/activate
  • Install all dependencies from requirements.txt
python -m pip install --upgrade pip
pip install -r requirements.txt
  • Start the project:
python manage.py runserver