diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5c80254 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "[python]": { + "editor.defaultFormatter": "ms-python.autopep8" + }, + "python.formatting.provider": "none" +} diff --git a/Python/TeleBot/__pycache__/FuncForBot.cpython-311.pyc b/Python/TeleBot/__pycache__/FuncForBot.cpython-311.pyc index 749672e..11190e1 100644 Binary files a/Python/TeleBot/__pycache__/FuncForBot.cpython-311.pyc and b/Python/TeleBot/__pycache__/FuncForBot.cpython-311.pyc differ diff --git a/Python/TeleBot/__pycache__/config.cpython-311.pyc b/Python/TeleBot/__pycache__/config.cpython-311.pyc index dd0b1e1..39c2daf 100644 Binary files a/Python/TeleBot/__pycache__/config.cpython-311.pyc and b/Python/TeleBot/__pycache__/config.cpython-311.pyc differ diff --git a/Python/TeleBot/__pycache__/parser.cpython-311.pyc b/Python/TeleBot/__pycache__/parser.cpython-311.pyc index e83e42f..ef7e0e0 100644 Binary files a/Python/TeleBot/__pycache__/parser.cpython-311.pyc and b/Python/TeleBot/__pycache__/parser.cpython-311.pyc differ diff --git a/Python/TeleBot/__pycache__/tableCreator.cpython-311.pyc b/Python/TeleBot/__pycache__/tableCreator.cpython-311.pyc index 4bee6ba..393f295 100644 Binary files a/Python/TeleBot/__pycache__/tableCreator.cpython-311.pyc and b/Python/TeleBot/__pycache__/tableCreator.cpython-311.pyc differ diff --git a/Python/TeleBot/config.py b/Python/TeleBot/config.py index 9c21df2..980be0e 100644 --- a/Python/TeleBot/config.py +++ b/Python/TeleBot/config.py @@ -1,5 +1,5 @@ hostname = "localhost" databname = "ada" -username = "ada" +username = "postgres" passw = "Ri588856" api = "6285042955:AAEPprYo9K7Ta0RkDcoqO2Z4Ejdw8to1NX0" \ No newline at end of file diff --git a/Python/TeleBot/img/0.jpg b/Python/TeleBot/img/0.jpg deleted file mode 100644 index 49bd483..0000000 Binary files a/Python/TeleBot/img/0.jpg and /dev/null differ diff --git a/Python/TeleBot/img/1.jpg b/Python/TeleBot/img/1.jpg deleted file mode 100644 index 04e47ef..0000000 Binary files a/Python/TeleBot/img/1.jpg and /dev/null differ diff --git a/Python/TeleBot/img/10.jpg b/Python/TeleBot/img/10.jpg deleted file mode 100644 index 697228c..0000000 Binary files a/Python/TeleBot/img/10.jpg and /dev/null differ diff --git a/Python/TeleBot/img/11.jpg b/Python/TeleBot/img/11.jpg deleted file mode 100644 index 0eeeff9..0000000 Binary files a/Python/TeleBot/img/11.jpg and /dev/null differ diff --git a/Python/TeleBot/img/12.jpg b/Python/TeleBot/img/12.jpg deleted file mode 100644 index 1f7bdb9..0000000 Binary files a/Python/TeleBot/img/12.jpg and /dev/null differ diff --git a/Python/TeleBot/img/13.jpg b/Python/TeleBot/img/13.jpg deleted file mode 100644 index 46ff547..0000000 Binary files a/Python/TeleBot/img/13.jpg and /dev/null differ diff --git a/Python/TeleBot/img/14.jpg b/Python/TeleBot/img/14.jpg deleted file mode 100644 index d79d495..0000000 Binary files a/Python/TeleBot/img/14.jpg and /dev/null differ diff --git a/Python/TeleBot/img/2.jpg b/Python/TeleBot/img/2.jpg deleted file mode 100644 index c7aea3b..0000000 Binary files a/Python/TeleBot/img/2.jpg and /dev/null differ diff --git a/Python/TeleBot/img/3.jpg b/Python/TeleBot/img/3.jpg deleted file mode 100644 index 083cde9..0000000 Binary files a/Python/TeleBot/img/3.jpg and /dev/null differ diff --git a/Python/TeleBot/img/4.jpg b/Python/TeleBot/img/4.jpg deleted file mode 100644 index ceb59fe..0000000 Binary files a/Python/TeleBot/img/4.jpg and /dev/null differ diff --git a/Python/TeleBot/img/5.jpg b/Python/TeleBot/img/5.jpg deleted file mode 100644 index 4c1bf3b..0000000 Binary files a/Python/TeleBot/img/5.jpg and /dev/null differ diff --git a/Python/TeleBot/img/6.jpg b/Python/TeleBot/img/6.jpg deleted file mode 100644 index 9417469..0000000 Binary files a/Python/TeleBot/img/6.jpg and /dev/null differ diff --git a/Python/TeleBot/img/7.jpg b/Python/TeleBot/img/7.jpg deleted file mode 100644 index bafbe29..0000000 Binary files a/Python/TeleBot/img/7.jpg and /dev/null differ diff --git a/Python/TeleBot/img/8.jpg b/Python/TeleBot/img/8.jpg deleted file mode 100644 index 0672188..0000000 Binary files a/Python/TeleBot/img/8.jpg and /dev/null differ diff --git a/Python/TeleBot/img/9.jpg b/Python/TeleBot/img/9.jpg deleted file mode 100644 index a7c53ab..0000000 Binary files a/Python/TeleBot/img/9.jpg and /dev/null differ diff --git a/Python/TeleBot/tableCreator.py b/Python/TeleBot/tableCreator.py index c31605c..57e06db 100644 --- a/Python/TeleBot/tableCreator.py +++ b/Python/TeleBot/tableCreator.py @@ -14,15 +14,17 @@ try: cursor.execute(creat_qwery) connection.commit() except psycopg2.errors.DuplicateTable: - print("s") + print("") for i in range(15): - print(i) url = 'https://amwine.ru' + \ parser.pictures[i].find('a').find('img').attrs['data-src'] filename = f"Python/TeleBot/image/{i}.jpg" - wget.download(url, filename) + try: + img = open(filename) + except IOError as e: + wget.download(url, filename) try: ins_qwery = f"""insert into public.Parser(page_name, price, priceDis, mark, scr) values ('{parser.name[i].text}', '{parser.price[i].text}', '{parser.priceDis[i].text}', '{parser.mark[i].text}', '{filename}')""" cursor.execute(ins_qwery)