https://github.com/zulusssss/homework_bot
api sp1 bot
https://github.com/zulusssss/homework_bot
pytest python-telegram-bot python3
Last synced: 11 months ago
JSON representation
api sp1 bot
- Host: GitHub
- URL: https://github.com/zulusssss/homework_bot
- Owner: Zulusssss
- Created: 2023-01-05T19:03:20.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-12-20T17:53:00.000Z (over 2 years ago)
- Last Synced: 2025-04-23T02:21:54.384Z (about 1 year ago)
- Topics: pytest, python-telegram-bot, python3
- Language: Python
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bot Assistant
[](https://www.python.org/)
[](https://docs.pytest.org/en/6.2.x/)
## Bot Features:
- Once every 10 minutes, it polls the API of the Practicum service and checks the status of the homework submitted for review.
- When updating the status, the API analyzes the response and sends you a corresponding notification in Telegram.
- Logs his work and informs you about important problems with a message in Telegram.
## Description
The telegram bot accesses the "Practicum" API service.Homework and finds out the status of homework: whether the homework was taken in the review, whether it was checked, and if it was checked, then the reviewer accepted it or returned it for revision.
An example of an assistant bot's response:
```python
{
"homeworks":[
{
"id":123,
"status":"approved",
"homework_name":"user__homework_bot-master.zip",
"reviewer_comment":"all right",
"date_updated":"2021-12-14T14:40:57Z",
"lesson_name":"name"
}
],
"current_date":1581804979
}
```
## Installation
1. Clone a repository:
```python
git clone git@github.com:Zulusssss/homework_bot.git
```
2. Go to the project folder:
```python
cd homework_bot/
```
3. Install a virtual environment for the project:
```python
python -m venv venv
```
4. Activate the virtual environment for the project:
```python
# for OS Linux and macOS
source venv/bin/activate
# for Windows OS
source venv/Scripts/activate
```
5. Install dependencies:
```python
python3 -m pip install --upgrade pip
pip install -r requirements.txt
```
6. Perform migrations at the project level:
```python
cd yatube
python3 manage.py makemigrations
python3 manage.py migrate
```
7. Register a chatbot in Telegram
8. Create a file in the root directory .env for storing environment variables
```python
PRAKTIKUM_TOKEN = 'xxx'
TELEGRAM_TOKEN = 'xxx'
TELEGRAM_CHAT_ID = 'xxx'
```
9. Run the project locally:
```python
# for OS Linux and macOS
python homework_bot.py
# for Windows OS
python3 homework_bot.py
```