{"id":381535,"date":"2024-06-29T03:43:20","date_gmt":"2024-06-29T03:43:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=381535"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T03:43:20","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=381535","title":{"rendered":"<span>\u041f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0431\u043e\u0442<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f \u043f\u043e\u0447\u0442\u0430 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439, \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447. \u0417\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0435 \u043f\u0438\u0441\u044c\u043c\u0430 \u043d\u043e\u0441\u044f\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0439 \u043b\u0438\u0431\u043e \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043c\u0435\u043d\u044f\u044e\u0449\u0435\u0439\u0441\u044f \u0441 \u0442\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041a \u0442\u0430\u043a\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0438\u0441\u0435\u043c \u0432 \u0435\u0434\u0438\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0434\u0430\u0442\u0435 \u0438\u043b\u0438 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435 \u043e\u0431 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435. <\/li>\n<li>\u0417\u0430\u043f\u0440\u043e\u0441\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043a\u0430\u043a\u043e\u0439 \u043b\u0438\u0431\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0435\/\u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043e\u0442\u0432\u0435\u0442\u043d\u044b\u043c \u043f\u0438\u0441\u044c\u043c\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0435 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0449\u0435\u043c\u0443. <\/li>\n<li>\u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0438\u0441\u044c\u043c\u0430 \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043a\u0430\u043a\u0443\u044e-\u043b\u0438\u0431\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0443. <\/li>\n<li>\u041f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043a\u0430\u043a\u0438\u0435 \u043b\u0438\u0431\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. <\/li>\n<li>\u0421 \u043a\u0430\u043a\u043e\u0439 \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0442\u0447\u0435\u0442\u044b, \u0444\u0430\u0439\u043b\u044b \u0438 \u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0435. <\/li>\n<\/ol>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0431\u0443\u0435\u043c, \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u0430, \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447. \u041d\u0438\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0431\u0430\u0437\u0438\u0441\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u044f\u0437\u044b\u043a\u0430 Python3. \u041a\u043e\u043c\u0443-\u0442\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u044d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430, \u0430 \u043a\u0442\u043e \u0443\u0436\u0435 \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u0441\u0442\u0430\u0442\u044c\u044e, \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0414\u043e\u043f\u043e\u043b\u043d\u044f\u044f \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043d\u043e\u0432\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0437\u0430\u0434\u0430\u0447, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442, \u0435\u0441\u043b\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0446\u0435\u043b\u044c \u043e\u043f\u0440\u0430\u0432\u0434\u044b\u0432\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443. <br \/>  <a name=\"habracut\"><\/a><br \/>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u044b:<\/p>\n<ul>\n<li>\u041f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b (\u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0437\u0430 \u0446\u0438\u043a\u043b, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b). <\/li>\n<li>\u041f\u0440\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u043f\u0438\u0441\u0435\u043c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438 \u0437\u0430\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0411\u0414.<\/li>\n<li>\u041f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u0438\u0441\u0435\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0411\u0414.<\/li>\n<\/ul>\n<p>  \u0417\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0434\u0443\u043b\u0435\u0439 (\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432) \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439, \u0443\u0441\u043b\u043e\u0432\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0438:<\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c:<\/p>\n<ul>\n<li>telegraf \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0434\u0432\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u043f\u043e\u0447\u0442\u044b \u0438 \u043f\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u0438\u0441\u0435\u043c. <\/li>\n<\/ul>\n<p>  \u0412\u0442\u0440\u043e\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c:  <\/p>\n<ul>\n<li>recive_parser_email \u0437\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043d\u0443\u0436\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0438\u0441\u0435\u043c \u0438 \u0437\u0430\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0411\u0414<\/li>\n<li>send_parse_email \u0437\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043d\u0443\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438\u0437 \u0411\u0414 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u043f\u0438\u0441\u0435\u043c<\/li>\n<\/ul>\n<p>  \u0422\u0440\u0435\u0442\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c:  <\/p>\n<ul>\n<li>_email2 \u0437\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u043f\u0440\u0438\u0435\u043c\u0430 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0438\u0441\u0435\u043c<\/li>\n<li>_sqlite \u0437\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0411\u0414 SQLite, \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438<\/li>\n<li>_data_parser \u0437\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0442\u0435\u043b\u0430 \u043f\u0438\u0441\u044c\u043c\u0430 \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u0432\u0438\u0434.<\/li>\n<\/ul>\n<p>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/le\/9u\/0k\/le9u0k8dkf7ae8dipxw-17vzbtq.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/le\/9u\/0k\/le9u0k8dkf7ae8dipxw-17vzbtq.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<h3>telegraf<\/h3>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u0412\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a Telegraf (\u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0441 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 influxDB) \u0438\u043b\u0438 crontab \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440. \u0414\u0430\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432 \u0444\u043e\u043d\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435:<\/p>\n<pre><code class=\"bash\">(vnev) [linux@test] python3.8 \/path_to_script\/telegraf.py >\/dev\/null 2>&amp;1 &lt; \/dev\/null &amp; <\/code><\/pre>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">telegraf.py<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import subprocess import path import time import _email2 import sys  count=0 while True:     try:         subprocess.check_call(['python3.8 '+path.path+'recive_parse_email.py'],shell=True, timeout=14)         subprocess.check_call(['python3.8 '+path.path+'send_parse_email.py'],shell=True, timeout=14)     except subprocess.TimeoutExpired:         _email2.send_email('\u041e\u0448\u0438\u0431\u043a\u0430', 'Exception timeout subprocess, module telegraf, line 11 '+str(count), 'test1@gmail.com')         count+=1         if count > 5:             sys.exit(1)     except Exception as e:         _email2.send_email('\u041e\u0448\u0438\u0431\u043a\u0430', 'Exception in module telegraf, line 11' + str(e), 'test1@gmail.com')         sys.exit(1)     time.sleep(30) <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0432\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430. \u0418\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 30 \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e 14 \u0441\u0435\u043a\u0443\u043d\u0434, \u0435\u0441\u043b\u0438 \u043f\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0434\u0432\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u0442\u043e \u043e\u043d \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u0438\u0445 \u043f\u043e\u0434\u0432\u0438\u0441\u0430\u043d\u0438\u0439 \u0431\u043e\u043b\u0435\u0435 5 \u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0435\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0438\u0434\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0438\u0441\u044c\u043c\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441 \u043a\u043e\u0434\u043e\u043c \u043e\u0448\u0438\u0431\u043a\u0438. \u0412 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043b\u043e\u0433\u0438 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e \u0431\u043e\u0442\u0430, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u043f\u043b\u043e\u0445\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 logging. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Path, \u0444\u0430\u0439\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0441\u0430\u043c\u043e\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043d\u043e \u0434\u043b\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u0443\u0442\u0435\u0439)<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">path.py<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">path=\"\/absolute_path_to_project_on_your system\/\" <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h3>recive_parser_email<\/h3>\n<p>  \u041c\u043e\u0434\u0443\u043b\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u0438\u0441\u0435\u043c \u0432 \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u043c \u044f\u0449\u0438\u043a\u0435. \u041f\u0440\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u043f\u0438\u0441\u044c\u043c\u0430 \u0438 \u0437\u0430\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0411\u0414. <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">recive_parser_email.py<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import re import _sqlite import _email2 import datetime from datetime import datetime import _data_parser # def write_data_to_sql(id_, from_,  subject, content, content_type): d={} #   0                1                  2                3                     4                         5 d[\"ID\"] = \" \"; d[\"\u0427\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\"] = \" \"; d[\"\u0441\u0442\u0430\u0442\u0443\u0441\"] = ' '; d[\"\u0434\u0430\u0442\u0430\"] = ' '; d['\u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c'] = ' '; d['\u0430\u0434\u0440\u0435\u0441 \u043f\u043e\u0447\u0442\u044b'] = ' ' if re.findall(r'\u0427\u0442\u043e \u0442\u044b \u043c\u043e\u0436\u0435\u0448\u044c', subject) != [] or re.findall(r'\u0447\u0442\u043e \u0442\u044b \u043c\u043e\u0436\u0435\u0448\u044c', subject) != []: status = \"well_to_know\" _sqlite.insert_data_sql(\"test_db\", \"'\"+d[\"ID\"]+\"', '\"+d[\"\u0427\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\"]+\"', '\"+status+\"', '\"\\ +str(datetime.now().strftime('%d.%m.%y  %H:%M:%S'))+\"', '\"+d['\u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c']+\"', '\"+from_+\"'\") if re.findall(r'\u041d\u0430\u043f\u043e\u043c\u043d\u0438_', subject) != [] or re.findall(r'\u043d\u0430\u043f\u043e\u043c\u043d\u0438_', subject) != []: d=_data_parser.table_parser2(content) status='remind' _sqlite.insert_data_sql(\"test_db\", \"'\" + d[\"ID\"] + \"', '\" + d[\"\u0427\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\"] + \"', '\" + status + \"', '\" \\ + str(datetime.now().strftime('%d.%m.%y  %H:%M:%S')) + \"', '\" + d['\u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c'] + \"', '\" + from_ + \"'\") # \u0414\u0430\u043b\u0435\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u043d\u0443\u0446\u0438\u044f \u043f\u043e \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f\u043c \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c \u0441 \u043d\u0438\u043c\u0438 # # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u043e\u0447\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0443\u043b\u044c _email2, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 k k=_email2.check_email_box() # # \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0430\u0435\u043c \u0432\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u043f\u043e\u0447\u0442\u0443 \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f sublist_to_delete=[]; list_to_delete=[] for i in k: #\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0437\u0430\u0433\u043b\u043e\u0432\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0411\u0414 write_data_to_sql(i[0], i[1],  i[2], i[3], i[4]) #\u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f if re.findall(r'\u0427\u0442\u043e \u0442\u044b \u043c\u043e\u0436\u0435\u0448\u044c', str(i[2])) != [] or re.findall(r'\u0447\u0442\u043e \u0442\u044b \u043c\u043e\u0436\u0435\u0448\u044c', str(i[2])) != [] or re.findall(r'\u041d\u0430\u043f\u043e\u043c\u043d\u0438_', str(i[2])) != []: sublist_to_delete.append(i[0]);sublist_to_delete.append(i[2]) list_to_delete.append(sublist_to_delete) #\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u044f _email2 _email2.delete_several_email(list_to_delete) <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0421\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 write_data_to_sql, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u0437\u0430\u0434\u0430\u0447\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u043f\u0438\u0441\u044c\u043c\u0430 (\u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u0437\u0430\u0434\u0430\u0447\u0438 \u2014 \u043d\u043e\u0432\u044b\u0439 if statement). \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0434\u0432\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0442\u0438\u043f\u0430 \u0437\u0430\u0434\u0430\u0447 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0438\u0441\u0435\u043c \u0432 \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u043c \u044f\u0449\u0438\u043a\u0435:<\/p>\n<ol>\n<li>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u043e\u0442\u043e\u043c, \u0431\u043e\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0438\u043f\u044b \u0437\u0430\u0434\u0430\u0447 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043f\u0438\u0441\u044c\u043c\u043e \u0441 \u0442\u0435\u043c\u043e\u0439 \u00ab\u0427\u0442\u043e \u0442\u044b \u043c\u043e\u0436\u0435\u0448\u044c\u00bb. <\/li>\n<li>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u0438\u0441\u044c\u043c\u0430 \u0441 \u0442\u0435\u043c\u043e\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u0441\u043b\u043e\u0432\u043e \u00ab\u041d\u0430\u043f\u043e\u043c\u043d\u0438_\u00bb. <\/li>\n<\/ol>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0442\u0430\u0431\u043b\u0438\u0446 \u0442\u0435\u043b\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f _data_parser.table_parser2, \u043a\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 (\u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u043d\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d, just in case):<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">_data_parser.py<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import re from html_table_parser import HTMLTableParser  def table_parser2(data): d={} p = HTMLTableParser() p.feed(data) for i in p.tables[0]: if re.findall(\"ID\", str(i)) != [] and re.findall(\"ID\", str(d)) == []: d[\"ID\"] = i[(i.index(\"ID\")+1)].replace(\" \",\"\") if re.findall(\"\u0427\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\", str(i)) != [] and re.findall(\"\u0427\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\", str(d)) == []: d[\"\u0427\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\"] = i[(i.index(\"\u0427\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\")+1)] if re.findall(\"\u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\", str(i)) != [] and re.findall(\"\u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\", str(d)) == []: d[\"\u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\"] = i[(i.index(\"\u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\") + 1)] if re.findall(\"ID\", str(d)) == []: d[\"ID\"] = '\u043d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445' if re.findall(\"\u0427\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\", str(d)) == []: d[\"\u0427\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\"] = '\u043d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445' if re.findall(\"\u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\", str(d)) == []: d[\"\u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\"] = '\u043d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445' return d <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0414\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 6 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (\u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 SQL \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438). \u0417\u0430\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u044f _sqlite.py. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u0447\u0442\u044b \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e list \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u044f _email2. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0438\u0441\u0435\u043c \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u043e\u0433\u043e \u0436\u0435 \u043c\u043e\u0434\u0443\u043b\u044f _email2. <\/p>\n<h3>send_parse_email<\/h3>\n<p>  \u041c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0411\u0414. \u041f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043a \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435, \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u0432\u0438\u0434 \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0443\u044e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0411\u0414. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 \u043b\u043e\u0433\u0438\u043a\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u044e recive_parser_email, \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u0437\u0430\u0434\u0430\u0447 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 check_sql_requests_action_by_one (\u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u0437\u0430\u0434\u0430\u0447\u0438 \u2014 \u043d\u043e\u0432\u044b\u0439 if statement). <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">send_parse_email.py<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import re import _sqlite import _email2 import datetime from datetime import timedelta from datetime import datetime import path  def adresses_from(list_): x2=re.findall('&lt;(.*?)>', list_) if x2!=[]: x1=re.findall('&lt;(.*?)>', list_)[0] else: x1=list_ return x1  def check_sql_requests_action_by_one(): check_exist = _sqlite.sql_row_names(\"test_db\") for i in check_exist: if i[2]=='well_to_know': name='Bot' f = open(path.path+'template_what_you_can.html', 'r') html=f.read() html = html.replace('{_data_}', name) _email2.send_email('\u0447\u0442\u043e \u044f \u043c\u043e\u0433\u0443', html, adresses_from (i[5])) _sqlite.delete_data_sql(\"test_db\", 'data_last_modify', i[3]) if i[2]=='remind': try: time_o = datetime.strptime(i[4], '%d.%m.%y %H:%M') time_error = ' ' except: time_o = datetime.strptime('01.01.30 00:00', '%d.%m.%y %H:%M') time_error = 'error_time_format' if time_o &lt;= datetime.now() and i[2] == 'remind' or time_error == 'error_time_format': _email2.send_email('\u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435 ' + i[0]+' '+time_error, i[1], adresses_from(i[5])) _sqlite.delete_data_sql(\"test_db\", 'data_last_modify', i[3]) if i[2] == 'YOUR PARSER': #\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043d\u0438\u043c\u0438 pass  check_sql_requests_action_by_one()  <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0442\u0435 \u0436\u0435 \u0434\u0432\u0430 \u0442\u0438\u043f\u0430 \u0437\u0430\u0434\u0430\u0447 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0411\u0414. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043b\u0430 \u043f\u0438\u0441\u044c\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f HTML \u0448\u0430\u0431\u043b\u043e\u043d, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u043e\u0432 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435. \u041f\u0440\u0438\u043c\u0435\u0440 \u0448\u0430\u0431\u043b\u043e\u043d\u0430:<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">template_what_you_can.html<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">&lt;!DOCTYPE html> &lt;html> &lt;head>     &lt;title>MF&lt;\/title> &lt;\/head> &lt;body>     &lt;p>\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c, \u044f {_data_},&lt;\/p>      &lt;p>\u0412\u043e\u0442 \u0447\u0442\u043e \u044f \u0443\u043c\u0435\u044e:&lt;\/p>      &lt;p>         1. \u041c\u043e\u0433\u0443 \u0441\u0434\u0435\u043b\u0430\u0439\u0442\u044c \u0417\u0410\u0414\u0410\u0427\u04231 ..., \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u044c \u043f\u0438\u0441\u044c\u043c\u0430\u043e \u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u043c ..., \u0432 \u0442\u0435\u043b\u0435 \u043f\u0438\u0441\u044c\u043c\u0430 \u0443\u043a\u0430\u0436\u0438 .... &lt;\/p>     &lt;p>         2. \u041c\u043e\u0433\u0443 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0417\u0410\u0414\u0410\u0427\u04232.\u00a0     &lt;\/p> &lt;p> \u0425\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0434\u043d\u044f!\u00a0      &lt;\/p> &lt;\/body> &lt;\/html> <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h3>_email2<\/h3>\n<p>  \u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u043f\u0440\u0438\u0435\u043c\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u043e\u0447\u0442\u044b, \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u0430\u0445 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">_email2.py<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import smtplib from email.mime.text import MIMEText from email.header import decode_header from email.mime.multipart import MIMEMultipart import mailparser import email import imaplib  # connect to Google's servers smtp_ssl_host = 'smtp.gmail.com' smtp_ssl_port = 465 EMAIL=username=from_addr = 'your_email@gmail.com' PASSWORD=password = 'your_pass' SERVER = 'imap.gmail.com'  #\u0421\u043f\u0438\u0441\u043e\u043a \u043d\u0430 \u043a\u0430\u043a\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u043e\u0447\u0442\u044b legal_list=['test1@gmail.com', 'test2@gmail.com']  #\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0430\u0434\u0440\u0435\u0441\u0430\u0442\u043e\u0432 \u043f\u043e\u0447\u0442\u044b def legal_check(list_adrrs): k=0 #ststus='' global legal_list if list_adrrs==list(list_adrrs): for i in list_adrrs: if i in legal_list: k+=1 else: if list_adrrs in legal_list: k+=1 if k >0: status='allow' else: status='deny' return status  #\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u0447\u0442\u043e\u0432\u0433\u043e \u044f\u0449\u0438\u043a\u0430 def check_email_box(): # \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f [[id, from, subject, content],[...]] global EMAIL; global PASSWORD;global SERVER mail = imaplib.IMAP4_SSL(SERVER) mail.login(EMAIL, PASSWORD) mail.select('inbox') # it will return with its status and a list of ids status, data = mail.search(None, 'ALL') # by white spaces on this format: [b'1 2 3', b'4 5 6'] mail_ids = [] for block in data: # b'1 2 3'.split() => [b'1', b'2', b'3'] mail_ids += block.split() # now for every id we'll fetch the email # to extract its content email_list = [] for i in mail_ids: email_=[] email_.append(i) # the fetch function fetch the email given its id # and format that you want the message to be status, data = mail.fetch(i, '(RFC822)') # the content data at the '(RFC822)' format comes on # a list with a tuple with header, content, and the closing # byte b')' for response_part in data: # so if its a tuple... if isinstance(response_part, tuple): mail_p = mailparser.parse_from_bytes(response_part[1]) if len(mail_p.from_[0])>1: email_.append(mail_p.from_[0][1]) else: email_.append(mail_p.from_[0][0]) email_.append(mail_p.subject) email_.append(mail_p.body) email_.append('html') email_list.append(email_) return email_list  #\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0438\u0441\u044c\u043c\u0430 def delete_one_email(id_, subject): # \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f [[id=b'1', from, subject, content],[...]] global EMAIL global PASSWORD global SERVER mail = imaplib.IMAP4_SSL(SERVER) mail.login(EMAIL, PASSWORD) mail.select('inbox') status, data = mail.search(None, 'ALL') mail_ids = [] mail_list = [] for block in data: mail_ids += block.split() for i in mail_ids: mail_ = [] mail_.append(i) status, data = mail.fetch(i, '(RFC822)') for response_part in data: if isinstance(response_part, tuple): message = email.message_from_bytes(response_part[1]) mail_from = message['from'] mail_subject = message['subject'] mail_.append(mail_from) try: bytes, encoding = decode_header(mail_subject)[0] mail_subject = bytes.decode(encoding) mail_.append(mail_subject) except: pass mail_.append(mail_subject) mail_list.append(mail_) k=0 for i in mail_list: if id_== i[0] and subject == i[2]: k+=1 else: pass if k > 0: pass mail.store(id_, '+FLAGS', '(\\Deleted)') mail.expunge()  #\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0438\u0441\u0435\u043c def delete_several_email(id_subject): # \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f [[id=b'1', from, subject, content],[...]] global EMAIL; global PASSWORD; global SERVER mail = imaplib.IMAP4_SSL(SERVER) mail.login(EMAIL, PASSWORD) mail.select('inbox') status, data = mail.search(None, 'ALL') mail_ids = [] mail_list = [] for block in data: mail_ids += block.split() for i in mail_ids: mail_ = [] mail_.append(i) status, data = mail.fetch(i, '(RFC822)') for response_part in data: if isinstance(response_part, tuple): message = email.message_from_bytes(response_part[1]) mail_from = message['from'] mail_subject = message['subject'] mail_.append(mail_from) try: bytes, encoding = decode_header(mail_subject)[0] mail_subject = bytes.decode(encoding) mail_.append(mail_subject) except: pass mail_.append(mail_subject) mail_list.append(mail_) for i in mail_list: for y in id_subject: if y[0] == i[0] and y[1] == i[2]: mail.store(y[0], '+FLAGS', '(\\Deleted)')  mail.expunge() else: pass  #\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u043e\u0447\u0442\u044b def send_email(subject_, message_, to_addrs, format='html'): global smtp_ssl_host; global smtp_ssl_port;global username global password; global from_addr if legal_check(to_addrs)==\"deny\": subject_ =\"email is not legal \"+str(to_addrs) to_addrs=username message = MIMEMultipart(\"alternative\") if format=='html': message = MIMEMultipart(\"alternative\", None, [MIMEText(message_,'html')]) if format=='text': message = MIMEMultipart(\"alternative\", None, [MIMEText(message_)]) message['subject'] = subject_ message['from'] = from_addr if to_addrs==list(to_addrs): message['to'] = ', '.join(to_addrs) else: message['to'] = (to_addrs) server = smtplib.SMTP_SSL(smtp_ssl_host, smtp_ssl_port) server.login(username, password) server.sendmail(from_addr, to_addrs, message.as_string()) server.quit() <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u0437\u044f\u0442 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 gmail, \u0432 \u0446\u0435\u043b\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 (\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0440\u0442\u044b \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440). \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0431\u0435\u043b\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 legal_check, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0438\u0441\u0435\u043c \u0430\u0434\u0440\u0435\u0441\u0430\u0442\u0430\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044f \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u044b\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0430\u0434\u0440\u0435\u0441\u0430\u0442\u043e\u0432 legal_list. <\/p>\n<h3>_sqlite<\/h3>\n<p>  \u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 sqlite, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">_sqlite.py<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import sqlite3 import path   db_name = path.path+\"test_db.db\"  def insert_data_sql(table, data):     global db_name     conn = sqlite3.connect(db_name)     cursor = conn.cursor()     cursor.execute(\"INSERT INTO \"+table+\" VALUES (\"+data+\")\")     conn.commit(); conn.close()  def delete_data_sql(table, Column, data):     global db_name     conn = sqlite3.connect(db_name)     cursor = conn.cursor()     cursor.execute(\"DELETE FROM \"+table+\" WHERE \"+Column+\" = '\"+data+\"'\")     conn.commit(); conn.close()  def update_data_sql(table, data):     global db_name     global db_table_name     conn = sqlite3.connect(db_name)     cursor = conn.cursor()     cursor.execute(\"UPDATE \"+table+\" SET \"+data)     conn.commit(); conn.close()  def sql_get_posts():     global db_name     conn = sqlite3.connect(db_name)     cursor = conn.cursor()     with conn:         cursor.execute(\"SELECT * FROM \"+db_table_name)         print(cursor.fetchall())  def sql_row_names(table):         global db_name         conn = sqlite3.connect(db_name)         cursor = conn.cursor()         cursor.execute(\"SELECT * FROM \"+table)         names = [description[0] for description in cursor.description]         names = cursor.fetchall()         return names  def sql_select_data(db_table_name, column_, name_):         global db_name         conn = sqlite3.connect(db_name)         cursor = conn.cursor()         cursor.execute(\"SELECT * FROM \"+db_table_name)         names = [description[0] for description in cursor.description]         cursor.execute(\"SELECT * FROM \"+db_table_name+\" WHERE \"+column_+\"='\"+name_+\"';\")         rows = cursor.fetchall()         for row in rows:             names.append(row)         conn.commit(); conn.close()         return names <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 SQLite \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438:<\/p>\n<pre><code class=\"bash\">- sqlite3 \/your_path\/test_db.db - \u0437\u0430\u0439\u0442\u0438 \u0432 \u0431\u0430\u0437\u0443 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 - .mode column - \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c - .header on - \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 - SELECT * FROM test_db; - \u0432\u044b\u0432\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b - DROP TABLE test_db - \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b - .quit - \u0432\u044b\u0445\u043e\u0434 <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">_sqlite_new_table.py<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import sqlite3 import path  conn = sqlite3.connect(path.path+\"test_db.db\") cursor = conn.cursor()   # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b cursor.execute(\"\"\"CREATE TABLE test_db (ID text, Service text, status text, data_last_modify text, remind_time text, from_email text)\"\"\")  <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u043b\u043e\u0436\u0435\u043d \u043d\u0430 GitHub \u043f\u043e <a href=\"https:\/\/github.com\/lost63\/mail_bot\" rel=\"nofollow noopener noreferrer\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>. <br \/>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0412\u0430\u0448\u0435 \u0432\u0440\u0435\u043c\u044f.<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/590515\/\"> https:\/\/habr.com\/ru\/articles\/590515\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f \u043f\u043e\u0447\u0442\u0430 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439, \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447. \u0417\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0435 \u043f\u0438\u0441\u044c\u043c\u0430 \u043d\u043e\u0441\u044f\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0439 \u043b\u0438\u0431\u043e \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043c\u0435\u043d\u044f\u044e\u0449\u0435\u0439\u0441\u044f \u0441 \u0442\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041a \u0442\u0430\u043a\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0438\u0441\u0435\u043c \u0432 \u0435\u0434\u0438\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0434\u0430\u0442\u0435 \u0438\u043b\u0438 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435 \u043e\u0431 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435. <\/li>\n<li>\u0417\u0430\u043f\u0440\u043e\u0441\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043a\u0430\u043a\u043e\u0439 \u043b\u0438\u0431\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0435\/\u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043e\u0442\u0432\u0435\u0442\u043d\u044b\u043c \u043f\u0438\u0441\u044c\u043c\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0435 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0449\u0435\u043c\u0443. <\/li>\n<li>\u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0438\u0441\u044c\u043c\u0430 \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043a\u0430\u043a\u0443\u044e-\u043b\u0438\u0431\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0443. <\/li>\n<li>\u041f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043a\u0430\u043a\u0438\u0435 \u043b\u0438\u0431\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. <\/li>\n<li>\u0421 \u043a\u0430\u043a\u043e\u0439 \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0442\u0447\u0435\u0442\u044b, \u0444\u0430\u0439\u043b\u044b \u0438 \u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0435. <\/li>\n<\/ol>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0431\u0443\u0435\u043c, \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u0430, \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447. \u041d\u0438\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0431\u0430\u0437\u0438\u0441\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u044f\u0437\u044b\u043a\u0430 Python3. \u041a\u043e\u043c\u0443-\u0442\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u044d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430, \u0430 \u043a\u0442\u043e \u0443\u0436\u0435 \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u0441\u0442\u0430\u0442\u044c\u044e, \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0414\u043e\u043f\u043e\u043b\u043d\u044f\u044f \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043d\u043e\u0432\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0437\u0430\u0434\u0430\u0447, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442, \u0435\u0441\u043b\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0446\u0435\u043b\u044c \u043e\u043f\u0440\u0430\u0432\u0434\u044b\u0432\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-381535","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/381535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=381535"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/381535\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=381535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=381535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=381535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}