diff --git a/.idea/22712.iml b/.idea/22712.iml
index 9e6c4ca..814382f 100644
--- a/.idea/22712.iml
+++ b/.idea/22712.iml
@@ -4,7 +4,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index a6fa933..5db6bd4 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index eb603c8..f2799a5 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,9 +4,12 @@
-
-
+
+
+
+
+
@@ -47,7 +50,7 @@
-
+
@@ -69,6 +72,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -156,6 +180,7 @@
+
@@ -229,7 +254,14 @@
1684673567872
-
+
+ 1684788290316
+
+
+
+ 1684788290316
+
+
@@ -251,7 +283,8 @@
-
+
+
diff --git a/Задания/task1/Kulikov/A_BOT_try1.py b/Задания/task1/Kulikov/A_BOT_try1.py
new file mode 100644
index 0000000..7d14efc
--- /dev/null
+++ b/Задания/task1/Kulikov/A_BOT_try1.py
@@ -0,0 +1,36 @@
+import telebot
+import psycopg2
+from telebot import types
+tovars=['1','2','3','4']
+
+def getcontent(i):
+ connection = psycopg2.connect(dbname='dbdata',
+ user='postgres', password='Q1w2e3r4',
+ host='localhost')
+ cursor = connection.cursor()
+ cursor.execute('''SELECT id, phone, price
+ FROM public.svyaznoy
+ where id = ''' + str(i))
+ b = cursor.fetchall()
+ for a in b:
+ c = 'Название модели: ' + str(a[1]) + ' Цена: ' + str(a[2])
+ cursor.close()
+ connection.close()
+ return c
+
+bot = telebot.TeleBot('6053050329:AAFEBguQ5-UE80bB_aNjjSoUdIT91BlPJCY')
+@bot.message_handler(commands=["start"])
+def start(m, res=False):
+ bot.send_message(m.chat.id, 'Здравствуйте, я Ваш бот, и вы попали в магазин, в котором есть всего 4 товара! Напишите цифру от 1 до 4,чтобы узнать информацию о нем)')
+@bot.message_handler(content_types=['text'])
+def handle_text(message):
+ if message.text.strip() in tovars:
+ answer = getcontent(message.text.strip())
+ bot.send_message(message.chat.id, answer)
+ img = open('tovar'+str(message.text.strip())+'.jpeg','rb')
+ bot.send_photo(message.chat.id, img)
+ else:
+ answer = 'Да, пока только 4, но все впереди!'
+ bot.send_message(message.chat.id, answer)
+
+bot.polling(none_stop=True, interval=0)
\ No newline at end of file
diff --git a/Задания/task1/Kulikov/L_BOT_try1.py b/Задания/task1/Kulikov/L_BOT_try1.py
index 73a0faa..e69de29 100644
--- a/Задания/task1/Kulikov/L_BOT_try1.py
+++ b/Задания/task1/Kulikov/L_BOT_try1.py
@@ -1,53 +0,0 @@
-import telebot
-import psycopg2
-import config
-bot = telebot.TeleBot(6053050329:AAFEBguQ5-UE80bB_aNjjSoUdIT91BlPJCY)
-
-def select(request):
- try:
- connection = psycopg2.connect(host=config.host, dbname=config.dbname, user=config.user,
- password=config.password)
- cursor = connection.cursor()
- cursor.execute(request)
- result = cursor.fetchall()
- except:
- result = "Ошибка"
- finally:
- cursor.close()
- connection.close()
- return result
-
-max_id = int(select("select max(id) from laptops")[0][0])
-bot = telebot.TeleBot(6053050329:AAFEBguQ5-UE80bB_aNjjSoUdIT91BlPJCY)
-@bot.message_handler(commands=["start"])
-def start(m, res=False):
- bot.send_message(m.chat.id, f'Привет. Введите идентификатор от 1 до {max_id}, чтобы получить данные: ')
-
-@bot.message_handler(content_types=["text"])
-def from_bd(message):
- try:
- current_id = int(message.text)
- except BaseException:
- bot.send_message(message.chat.id, "Вы неправильно ввели ID. Попробуйте снова:")
- return
- if current_id > max_id:
- bot.send_message(message.chat.id, "ID больше, чем количество товаров. Попробуйте снова:")
- return
- else:
- try:
- data = select(f"select * from laptops where id = {current_id}")[0][1:]
- if type(data) == str:
- bot.send_message(message.chat.id, "Ошибка на сервере")
- return
- s = data[:-1]
- names_of_columns = ["Товар", "Цена", "Диагональ", "Разрешение", "Процессор", "Оперативная память",
- "Графический контроллер", "Объём диска"]
- everydata = []
- for data_name, column_name in zip(s, names_of_columns):
- everydata.append(column_name.capitalize() + ": " + data_name)
- bot.send_message(message.chat.id, "\n\n".join(everydata))
- bot.send_photo(message.chat.id, open(data[-1], 'rb'))
- except:
- bot.send_message(message.chat.id, "Ошибка на сервере")
- bot.send_message(message.chat.id, f"Введите следующий ID от 1 до {max_id}:")
-bot.polling(none_stop=True, interval=0)
diff --git a/Задания/task1/Kulikov/db_parsV2.0.py b/Задания/task1/Kulikov/db_parsV2.0.py
index 2892449..6a1fff5 100644
--- a/Задания/task1/Kulikov/db_parsV2.0.py
+++ b/Задания/task1/Kulikov/db_parsV2.0.py
@@ -6,7 +6,7 @@ import time
import wget
import psycopg2
import re
-s = Service('C:\Users\Alex\PycharmProjects\pythonProject\chromedriver.exe')
+s = Service('C:\\Users\\Alex\\PycharmProjects\\pythonProject\\chromedriver.exe')
browser = webdriver.Chrome(service=s)
browser.get('https://music.yandex.ru/chart')
time.sleep (1)