Giter Site home page Giter Site logo

homework_bot's Introduction

Telegram Bot for Yandex.Practicum Homework Service

The goal of this bot is to notify users about the status of their homework reviews on the Yandex.Practicum - Yandex.Homework service. The bot periodically checks the review status via the service's API every 10 minutes, and if the status changes, it sends a notification to the user.

How to Run the Project:

Clone the repository and navigate to it in the command line:

git clone [email protected]:Ice444-222/homework_bot.git 
cd homework_bot

Create and activate a virtual environment:

python3 -m venv env
source env/bin/activate

Install dependencies from the requirements.txt file:

python3 -m pip install --upgrade pip
pip install -r requirements.txt

Technology Stack:

Python 3.9.10
python-telegram-bot 13.7
requests 2.26.0

Description of Operation:

The main logic of the program is described in the main() function, which consists of the following functions:

get_api_answer(): Sends a request to the only API endpoint of the Yandex.Homework service, returns information about the latest homework.
parse_status(): Extracts the current status and title of the homework from the information.
send_message(): Sends a message to the Telegram chat.

Environment Variables:

It is safer to store the tokens for accessing the Yandex.Homework API (PRAKTIKUM_TOKEN), Telegram bot token (TELEGRAM_TOKEN), and Telegram chat ID (TELEGRAM_CHAT_ID) not directly in the code but in environment variables. The "location" of storing them depends on how you deploy the project; you can store them locally in the .env folder.

homework_bot's People

Contributors

ice444-222 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.