{"id":301261,"date":"2020-04-03T21:00:27","date_gmt":"2020-04-03T21:00:27","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=301261"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-04-03T21:00:27","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=301261","title":{"rendered":"\u041d\u0430\u0447\u043d\u0438 \u0437\u0430\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u043e\u0444\u0442\u0435: c\u043e\u0437\u0434\u0430\u043d\u0438\u0435 mini-digital-business"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/495594\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hn\/do\/t7\/hndot78f5tlzjqujos6-i7j8mnu.gif\"><\/p>\n<p>  \u0421\u0438\u0434\u044f \u043d\u0430 freelance \u0432\u0438\u0434\u0435\u043b \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043e \u0441\u0431\u043e\u0440\u0443 \u0411\u0414. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0441\u044f\u0442 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f\u0445 \u0438\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 Google, Yandex \u043a\u0430\u0440\u0442\u0430\u0445. <\/p>\n<p>  \u0415\u0441\u0442\u044c \u0441\u043f\u0440\u043e\u0441, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u043e \u043e\u0431\u043e \u0432\u0441\u0451\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c Telegram bot, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u043e\u0434\u0430 (\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0438\u0441\u043a) \u0438 \u0437\u0430\u043f\u0440\u043e\u0441 (\u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0438\u0441\u043a. <\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u0411\u0430\u0440, \u041a\u043e\u0444\u0435, \u0420\u0435\u0441\u0442\u043e\u0440\u0430\u043d \u0438 \u0442.\u0434.). \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c donation, \u043e\u043f\u043b\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0443\u0441\u043b\u0443\u0433\u0443 \u043f\u043e \u0441\u0431\u043e\u0440\u0443 \u0411\u0414 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u043d\u0430 \u043f\u043e\u0447\u0442\u0443 \u0411\u0414.<\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438:<\/p>\n<ol>\n<li> <a href=\"https:\/\/core.telegram.org\/bots\/api\" rel=\"nofollow\">Telegram API;<\/a><\/li>\n<li> <a href=\"https:\/\/tech.yandex.ru\/maps\/\" rel=\"nofollow\">Yandex API;<\/a><\/li>\n<li> <a href=\"https:\/\/core.telegram.org\/api\/payments\" rel=\"nofollow\">Payments API.<\/a><\/li>\n<\/ol>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u044b\u0431\u0440\u0430\u043d\u044b \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438.  <\/p>\n<blockquote><p>\u042d\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u043e\u0439. \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0442.\u043a. <a href=\"https:\/\/tech.yandex.ru\/maps\/commercial\/doc\/concepts\/about-enterprise-docpage\/?from=geosearch#conditions\" rel=\"nofollow\">\u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 \u042f\u043d\u0434\u0435\u043a\u0441\u0430<\/a> \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<blockquote><p>\u041e \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u043e \u0436\u0435, \u0447\u0442\u043e \u0438 \u043e \u0437\u0430\u043a\u043e\u043d\u0430\u0445: \u0438\u0445 \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0435 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u0438\u0445. &copy;\u0414\u044e\u0431\u044d<\/p><\/blockquote>\n<\/blockquote>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h3>\n<p>  \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 3 \u0444\u0430\u0439\u043b\u0430. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c <i><b>bot.py<\/b><\/i>, <i><b>yandex.py<\/b><\/i>, <i><b>send_email.py<\/b><\/i>.<\/p>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Yandex.py<\/b><\/p>\n<div class=\"spoiler_text\">\n<ul>\n<li>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:\n<pre><code class=\"python\"># -*- coding: utf-8 -*- import requests import xlwt, xlrd from xlutils.copy import copy as xlcopy<\/code><\/pre>\n<p>  <\/li>\n<li>\u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a Yandex API \u043d\u0443\u0436\u043d\u043e <a href=\"https:\/\/yandex.ru\/dev\/site\/api\/concepts\/access-docpage\/\" rel=\"nofollow\">\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c<\/a> \u043a\u043b\u044e\u0447, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0443\u0442 \u0412\u0430\u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041a\u043b\u044e\u0447\u0438 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <i><b>maps api<\/b><\/i> \u0438 <i><b>location api<\/b><\/i> \u0440\u0430\u0437\u043d\u044b\u0435.<br \/>  \u0417\u0430\u0434\u0430\u0435\u043c api \u043a\u043b\u044e\u0447\u0438:<br \/> \n<pre><code class=\"python\">apikey = '*******-***-****-****-************' apikey_location = '********-****-****-****-************'<\/code><\/pre>\n<p>  <\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u0449\u0435\u0433\u043e \u043a\u043e\u043b-\u0432\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432:<br \/> \n<pre><code class=\"python\">def sum_taken_object(all_informations):     try:         found = str(all_informations['properties']['ResponseMetaData']['SearchResponse']['found'])     except KeyError:         found = '-'     return found<\/code><\/pre>\n<p>  <\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438:<br \/> \n<pre><code class=\"python\">def get_all_infomations(text, city):     value_low_upp, point = get_location(city)     low = value_low_upp[0].split(',')     upp = value_low_upp[1].split(',')     informations = requests.get('https:\/\/search-maps.yandex.ru\/v1\/?'                                 'apikey='+apikey+'&amp;'                                 'text='+text+'&amp;'                                 'lang=ru_RU&amp;'                                 'll='+point[0]+'&amp;'                                 'bbox='+low[1]+','+low[0]+'~'+upp[1]+','+upp[0]+'&amp;'                                 'results=500')     return informations.json()<\/code><\/pre>\n<p>\u0412 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 <i><b>requests.get<\/b><\/i> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i><b>bbox<\/b><\/i> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u043e\u0438\u0441\u043a\u0430, \u0430 <i><b>ll<\/b><\/i> \u043d\u0430 \u0446\u0435\u043d\u0442\u0440 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u043e\u0438\u0441\u043a\u0430. \u041c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i><b>ll<\/b><\/i> \u0431\u0435\u0437 <i><b>bbox<\/b><\/i>, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0446\u0435\u043d\u0442\u0440\u0435 \u0433\u043e\u0440\u043e\u0434\u0430. \u041e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/tech.yandex.ru\/maps\/geosearch\/doc\/concepts\/request-docpage\/\" rel=\"nofollow\">\u0442\u0443\u0442<\/a>.  <\/p>\n<blockquote><p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435 500 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0435 \u0432\u0435\u0440\u043d\u0435\u0442. <\/p>\n<blockquote><p>\u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0431\u043e\u0440\u0430 \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0449\u0438\u0445 \u043a\u043e\u043b-\u0432\u043e 500, \u043e\u0442\u043f\u0438\u0448\u0438\u0442\u0435\u0441\u044c. \u0421\u0434\u0435\u043b\u0430\u044e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0441\u0442.<\/p><\/blockquote>\n<\/blockquote>\n<p>  <\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0433\u043e\u0442\u044b \u0438 \u0448\u0438\u0440\u043e\u0442\u044b:\n<pre><code class=\"python\">def get_location(city):     location = requests.get('https:\/\/geocode-maps.yandex.ru\/1.x\/?'                             'apikey='+apikey_location+'&amp;'                             'geocode='+city.title()+'&amp;'                             'format=json')     loc = location.json()     loc = loc['response']['GeoObjectCollection']['featureMember']     point = loc[0]['GeoObject']['Point']['pos'].split()     value_lower = loc[0]['GeoObject']['boundedBy']['Envelope']['lowerCorner'].split()     value_upper = loc[0]['GeoObject']['boundedBy']['Envelope']['upperCorner'].split()     value_low_upp = [value_lower[1]+','+value_lower[0], value_upper[1]+','+value_upper[0]]     return value_low_upp, point<\/code><\/pre>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u043e\u043b\u0433\u043e\u0442\u0443 \u0438 \u0448\u0438\u0440\u0438\u043d\u0443 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0438 \u0446\u0435\u043d\u0442\u0440\u0430.  <\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b-\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432:\n<pre><code class=\"python\">def get_information_limit(text,city):     value_low_upp, point = get_location(city)     low = value_low_upp[0].split(',')     upp = value_low_upp[1].split(',')     info = requests.get('https:\/\/search-maps.yandex.ru\/v1\/?'                         'apikey='+apikey+'&amp;'                         'text='+text+'&amp;'                         'lang=ru_RU&amp;'                         'll='+point[0]+'&amp;'                         'bbox='+low[1]+','+low[0]+'~'+upp[1]+','+upp[0]+'&amp;'                         'results=5&amp;'                         'skip=5')     information = info.json()     information = information['features']     list = {}     i = 1     for key in information:         try:             coordinates = str(key['geometry']['coordinates'])         except KeyError:             coordinates = '-'         try:             name = str(key['properties']['CompanyMetaData']['name'])         except KeyError:             name = '-'         try:             address = str(key['properties']['CompanyMetaData']['address'])         except KeyError:             address = '-'         try:             url = str(key['properties']['CompanyMetaData']['url'])         except KeyError:             url = '-'         try:             phones = key['properties']['CompanyMetaData']['Phones']         except KeyError:             phones = '-'         try:             hours = str(key['properties']['CompanyMetaData']['Hours']['text'])         except KeyError:             hours = '-'          for k in phones:             try:                 phones = k['formatted']             except TypeError:                 pass          list['object'+str(i)] = {'coordinates':coordinates,'name':name,'address':address,'url':url,'phones':phones,'hours':hours}         i += 1     return list<\/code><\/pre>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043f\u043e <b>5<\/b> \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c. \u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u043b-\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0442\u043e\u0433\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 <i><b>resul<\/b><\/i>, <i><b>skip<\/b><\/i> \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 <i><b>requests.get<\/b><\/i>.   <\/li>\n<li>\u0417\u0430\u043f\u0438\u0441\u044c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Excel \u0444\u0430\u0439\u043b:\n<pre><code class=\"python\">def write_exl(text, city_name):     try:         name_excel_BD = creat_excel_file(name='{}_{}'.format(text, city_name))         read_book = xlrd.open_workbook(name_excel_BD)  # \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442         write_book = xlcopy(read_book)  # \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u043f\u0430\u043c\u044f\u0442\u044c, \u0432 \u043d\u0435\u0451 \u043c\u044b \u043d\u0438\u0436\u0435 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c         write_sheet = write_book.get_sheet(0)  # \u0411\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u043b\u0438\u0441\u0442         # index = read_book.sheet_by_index(0).nrows # \u041d\u043e\u043c\u0435\u0440 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438         url_maps = 'https:\/\/yandex.ru\/maps\/org\/'         info = get_all_infomations(text=text, city=city_name)          for number, inf in enumerate(info['features']):             try:                 name_object = inf['properties']['CompanyMetaData']['name']             except KeyError:                 name_object = '-'             try:                 address = inf['properties']['CompanyMetaData']['address']             except KeyError:                 address = '-'             try:                 time_work = inf['properties']['CompanyMetaData']['Hours']['text']             except KeyError:                 time_work = '-'             try:                 id_organization = inf['properties']['CompanyMetaData']['id']             except KeyError:                 id_organization = '-'              write_sheet.write(int(number), 0, city_name)  # \u0413\u043e\u0440\u043e\u0434             write_sheet.write(int(number), 1, name_object)  # \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430             write_sheet.write(int(number), 2, address)  # \u0410\u0434\u0440\u0435\u0441             write_sheet.write(int(number), 3, time_work)  # \u0412\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b             write_sheet.write(int(number), 4, url_maps + str(id_organization))  # Url \u043d\u0430 \u043a\u0430\u0440\u0442\u0435         write_book.save(name_excel_BD)  # \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443         return True, name_excel_BD     except TypeError or KeyError as err:         return False<\/code><\/pre>\n<p>  <\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 Excel:\n<pre><code class=\"python\">def creat_excel_file(name):     book = xlwt.Workbook('utf8')     book.add_sheet('\u0411\u0430\u0437\u0430_{}'.format(name))     book.save('BD_{}.xls'.format(name))     return 'BD_{}.xls'.format(name)<\/code><\/pre>\n<p>  <\/li>\n<\/ul>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Send_email.py<\/b><\/p>\n<div class=\"spoiler_text\">\n<ul>\n<li>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:\n<pre><code class=\"python\">#!\/usr\/bin\/env python #   coding: utf8  from smtplib import SMTP_SSL from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase from email import encoders import os<\/code><\/pre>\n<p>  <\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0438\u0441\u0435\u043c \u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c:\n<pre><code class=\"python\">def send_mail(name_file, to_address):     filepath = name_file     address_from = &quot;********@gmail.com&quot;     address_to = to_address     password = '************'     mail_adr = 'smtp.gmail.com'     mail_port = 465      # Compose attachment     part = MIMEBase('application', &quot;octet-stream&quot;)     part.set_payload(open(filepath, &quot;rb&quot;).read())     encoders.encode_base64(part)     part.add_header('Content-Disposition', &quot;attachment&quot;, filename=&quot;%s&quot; % os.path.basename(filepath))      # Compose message     msg = MIMEMultipart()     msg['From'] = address_from     msg['To'] = address_to     msg.attach(part)      # Send mail     smtp = SMTP_SSL(mail_adr)     smtp.set_debuglevel(1)     smtp.connect(host=mail_adr, port=mail_port)     smtp.login(address_from, password)     smtp.sendmail(address_from, address_to, msg.as_string())     smtp.quit()<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 Gmail, \u0412\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0439\u0442\u0438 \u0432 \u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u043d\u0430 Google \u2013 \u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0438 \u0432 \u00ab<b>\u041d\u0435\u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0443<\/b>\u00bb \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c, \u0438\u043d\u0430\u0447\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u0438\u0441\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Gmail.<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kc\/zw\/qy\/kczwqy_gvegqyv85jjvak_ekrx4.png\">  <\/li>\n<\/ul>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Bot.py<\/b><\/p>\n<div class=\"spoiler_text\">\n<ul>\n<li>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:\n<pre><code class=\"python\"># -*- coding: utf-8 -*- import telebot from telebot.types import LabeledPrice import re  import yandex from send_email import send_mail<\/code><\/pre>\n<p>  <\/li>\n<li><a href=\"https:\/\/www.siteguarding.com\/en\/how-to-get-telegram-bot-api-token\" rel=\"nofollow\">\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c<\/a> token \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e:\n<pre><code class=\"python\">token = '*********:**********************************' bot = telebot.TeleBot(token)<\/code><\/pre>\n<p>  <\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043a\u043e\u043c\u0430\u043d\u0434:\n<pre><code class=\"python\">@bot.message_handler(commands=['start', 'donation']) def send_welcom(message):     if message.text == '\/start':         keyboard = telebot.types.InlineKeyboardMarkup()         keyboard.row(telebot.types.InlineKeyboardButton('\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u0430\u0437\u0443', callback_data='bd_get'))         bot.send_message(message.chat.id, '\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435: ', reply_markup=keyboard)      if message.text == '\/donation':         bot.send_invoice(message.chat.id,                          title='Donation',                          description='\u041c\u043e\u0436\u0435\u0448\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u0443\u044e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u044c.',                          invoice_payload='donation',                          provider_token='*********:TEST:*******',                          currency='RUB',                          prices=[LabeledPrice(label='Donation', amount=10000)],                          start_parameter='pay_start',                          photo_url='https:\/\/cdn.imgbin.com\/22\/0\/5\/imgbin-donation-computer-icons-'                                    'fundraising-justgiving-charitable-organization-donation-'                                    '5Yehm9UecF2cRWrqtms4e6emn.jpg',                          photo_height=512,  # !=0\/None or picture won't be shown                          photo_width=512,                          photo_size=512,                          is_flexible=False)<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 <i><b>IF<\/b><\/i> \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 <i><b>\/start<\/b><\/i>, \u0432\u0442\u043e\u0440\u043e\u0439 <i><b>IF<\/b><\/i> \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 <i><b>\/donation<\/b><\/i>.<br \/>  \u0412 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 <i><b>invoice_payload<\/b><\/i> \u0437\u0430\u0434\u0430\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043e\u043f\u043b\u0430\u0442\u044b.<\/p>\n<p>  \u0412 <i><b>bot.send_invoice<\/b><\/i> \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c <b>token<\/b> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439. \u041a\u0430\u043a \u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"https:\/\/core.telegram.org\/bots\/payments#going-live\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.  <\/p>\n<blockquote><p>\u0414\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 token \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430. \u041f\u0440\u0438 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f, \u043d\u043e \u0434\u0435\u043d\u044c\u0433\u0438 \u043d\u0435 \u0441\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f. \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0412\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 token.<br \/>  \u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439: <i><b>123:TEST:XXXX<\/b><\/i><br \/>  \u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0439: <i><b>123:LIVE:XXXX<\/b><\/i>  <\/p><\/blockquote>\n<\/li>\n<li>\u0414\u0430\u043d\u043d\u044b\u0439 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0437\u0430\u043a\u0430\u0437\u0430:\n<pre><code class=\"python\">@bot.pre_checkout_query_handler(func=lambda query: True) def checkout(message):     bot.answer_pre_checkout_query(message.id, ok=True,                                   error_message=&quot;\u0418\u043d\u043e\u043f\u043b\u0430\u043d\u0435\u0442\u044f\u043d\u0435 \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0443\u043a\u0440\u0430\u0441\u0442\u044c CVV \u0432\u0430\u0448\u0435\u0439 \u043a\u0430\u0440\u0442\u044b, &quot;                                                 &quot;\u043d\u043e \u043c\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0449\u0438\u0442\u0438\u043b\u0438 \u0432\u0430\u0448\u0438 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. &quot;                                                 &quot;\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439 \u0440\u0430\u0441\u043f\u043b\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0443\u0442, &quot;                                                 &quot;\u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0442\u0434\u044b\u0445.&quot;)<\/code><\/pre>\n<p>\u0422.\u043a. \u0443 \u043d\u0430\u0441 digital \u0443\u0441\u043b\u0443\u0433\u0430, \u043e\u043d\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043f\u043e \u044d\u0442\u043e\u043c\u0443, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i><b>ok<\/b><\/i> \u0432\u0441\u0435\u0433\u0434\u0430 <i><b>True<\/b><\/i>. \u0411\u0435\u0437 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043e\u043f\u043b\u0430\u0442\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0435\u0441\u043b\u0438 \u0443 \u0412\u0430\u0441, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u0430\u0433\u0430\u0437\u0438\u043d \u043e\u0431\u0443\u0432\u0438. \u041a\u043b\u0438\u0435\u043d\u0442 \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0437\u0430\u043a\u0430\u0437, \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0442 \u043e\u043f\u043b\u0430\u0442\u0438\u0442\u044c \u0438 \u0432 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0412\u0430\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439. \u0415\u0441\u043b\u0438 \u043d\u0430 \u0441\u043a\u043b\u0430\u0434\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u043e\u0432\u0430\u0440, \u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i><b>ok=True<\/b><\/i> \u0438\u043d\u0430\u0447\u0435 \u0437\u0430\u0434\u0430\u0435\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <i><b>False<\/b><\/i> \u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u0432\u0438\u0434\u0438\u0442 \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u043e\u043a\u043d\u043e \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u043d \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 <i><b>error_message<\/b><\/i>.  <\/li>\n<li>\u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u043e\u043f\u043b\u0430\u0442\u0443 \u0437\u0430\u043a\u0430\u0437\u0430:\n<pre><code class=\"python\">@bot.message_handler(content_types=['successful_payment']) def got_payment(message):     if message.json['successful_payment']['invoice_payload'].split(',')[0] == 'buy':         email = message.json['successful_payment']['order_info']['email']         bot.send_message(message.chat.id,                          '\u0423\u0440\u0430\u0430\u0430\u0430! \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043e\u043f\u043b\u0430\u0442\u0443 \u043d\u0430 \u0441\u0443\u043c\u043c\u0443: `{} {}`.\\n'                          '\u0412\u0430\u043c \u043d\u0430 \u043f\u043e\u0447\u0442\u0443 (`{}`) \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e \u043f\u0438\u0441\u044c\u043c\u043e \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445.\\n\\n' \\                          '\u041f\u043e \u0432\u0441\u0435\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0438\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0439\u0442\u0435\u0441\u044c @\u0438\u043c\u044f_\u0430\u0434\u043c\u0438\u043d\u0430'\\                          .format(message.successful_payment.total_amount \/ 100,                                  message.successful_payment.currency,                                  email),                         parse_mode='Markdown')         request_text = message.json['successful_payment']['invoice_payload'].split(',')[1]         city = message.json['successful_payment']['invoice_payload'].split(',')[2]         write_in_BD, name_excel_BD = yandex.write_exl(text=request_text, city_name=city)         if write_in_BD == True:             send_mail(name_file=name_excel_BD, to_address=email)      elif message.json['successful_payment']['invoice_payload'] == 'donation':         bot.send_video(message.chat.id, 'https:\/\/media0.giphy.com\/media\/QAsBwSjx9zVKoGp9nr\/giphy.gif')<\/code><\/pre>\n<p>  <\/li>\n<li>\u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u044b\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 <i><b>InlineKeyboardMarkup<\/b><\/i>:\n<pre><code class=\"python\">@bot.callback_query_handler(func=lambda call: True) def callback_key(message):     if message.data == 'bd_get':         input_city(message)     elif re.search(r'bd_yes\/',message.data):         location = re.sub('bd_yes\/','',message.data)         bot.answer_callback_query(message.id, text=location, show_alert=False)         input_text(message, city=location)     elif message.data == 'bd_no':         input_city(message)     elif re.search(r'pay', message.data):         info_get_bd_limit = re.split(r'\/',message.data)         sent_text = info_get_bd_limit[1]         sent_city = info_get_bd_limit[2]         found = info_get_bd_limit[3]         bot.answer_callback_query(message.id, text='\u041e\u043f\u043b\u0430\u0442\u0430', show_alert=False)         pay(message, text=sent_text, city=sent_city, found=found)<\/code><\/pre>\n<p>  <\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0447\u0435\u0442 \u043d\u0430 \u043e\u043f\u043b\u0430\u0442\u0443:\n<pre><code class=\"python\">def pay(message, text, city, found):     bot.send_invoice(message.from_user.id,                      title='\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445',                      description='\u041e\u043f\u043b\u0430\u0442\u0430 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443.\\n'                                  '\u0422\u0435\u043a\u0441\u0442: '+text+'\\n\u0413\u043e\u0440\u043e\u0434: '+city+'\\n\u041a\u043e\u043b-\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432: '+found,                      invoice_payload='buy,{},{}'.format(text, city),                      provider_token='*********:TEST:*******',                      currency='RUB',                      prices=[LabeledPrice(label='\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445', amount=20000)],                      start_parameter='pay_start',                      photo_url='https:\/\/encrypted-tbn0.gstatic.com\/images?q=tbn:'                                'ANd9GcRVUs3eGt4U9YSXZrsbOkJoNEdpcYUdq0vEzM-ci_oIxEWs1FK0',                      photo_height=300,                      photo_width=300,                      photo_size=300,                      need_email=True,                      is_flexible=False)<\/code><\/pre>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i><b>need_email<\/b><\/i> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u043e\u0447\u0442\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0411\u0414.  <\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u043e\u0434\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0438\u0441\u043a:\n<pre><code class=\"python\">def input_city(message):     bot.send_message(message.from_user.id, '\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0433\u043e\u0440\u043e\u0434:')     bot.register_next_step_handler_by_chat_id(message.from_user.id, get_city)     bot.answer_callback_query(message.id, text='\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0433\u043e\u0440\u043e\u0434', show_alert=False)<\/code><\/pre>\n<p>  <\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u044e, \u0434\u043b\u044f \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0433\u043e\u0440\u043e\u0434\u0430:<br \/> \n<pre><code class=\"python\">def get_city(message):     get_location, get_location_point = yandex.get_location(message.text)     keyboard = telebot.types.InlineKeyboardMarkup()     keyboard.row(telebot.types.InlineKeyboardButton('\u0414\u0430', callback_data='bd_yes\/'+message.text),                  telebot.types.InlineKeyboardButton('\u041d\u0435\u0442', callback_data='bd_no'))     bot.send_location(message.chat.id, get_location_point[1], get_location_point[0], reply_markup=keyboard)<\/code><\/pre>\n<p>  <\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0432\u0432\u043e\u0434 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0447\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442:\n<pre><code class=\"python\">def input_text(message, city=None):     global location_city     location_city = city     info_message_id = bot.send_message(message.from_user.id, '\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u0430\u0440): ')     bot.register_next_step_handler_by_chat_id(message.from_user.id, get_bd_limit)<\/code><\/pre>\n<p>  <\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b-\u0432\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 \u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043e\u043f\u043b\u0430\u0442\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u0443\u044e \u0411\u0414:\n<pre><code class=\"python\">def get_bd_limit(message):     information = yandex.get_information_limit(message.text, location_city)     if information:         found = yandex.sum_taken_object(yandex.get_all_infomations(message.text, location_city))         bot.send_message(message.from_user.id, '\u0411\u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.\\n'                                                '\u0411\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e 5 \u043f\u0435\u0440\u0432\u044b\u0445 \u043f\u043e\u043f\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432.')         i = 1         text = ''         for key, value in information.items():             name = value['name']             address = value['address']             url = value['url']             phones = value['phones']             hours = value['hours']             text = text + '' + str(i) + ') \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435: '+name+'\\n\u0410\u0434\u0440\u0435\u0441: '+address+'\\n\u0421\u0430\u0439\u0442: '+url+\\                                         '\\n\u0422\u0435\u043b\u0435\u0444\u043e\u043d: '+phones+'\\n\u0412\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b: '+hours+'\\n----------\\n'             i += 1         bot.send_message(message.from_user.id, text, disable_web_page_preview=True)          keyboard = telebot.types.InlineKeyboardMarkup()         keyboard.row(telebot.types.InlineKeyboardButton('\u041e\u043f\u043b\u0430\u0442\u0438\u0442\u044c 200 \u0440\u0443\u0431.',                                                         callback_data='pay\/' + message.text+'\/'+location_city+'\/'+found))         bot.send_message(message.from_user.id, '\u0412\u0441\u0435\u0433\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u043e \u0432\u0430\u0448\u0435\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443: ' + found+''                                                 '\\n\\n\u0412\u0441\u044e \u0431\u0430\u0437\u0443 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 \u043f\u043e\u0447\u0442\u0443.', reply_markup=keyboard)     else:         bot.send_message(message.from_user.id, '\u041d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443!') <\/code><\/pre>\n<p>  <\/li>\n<li>\u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e <a href=\"https:\/\/github.com\/eternnoir\/pyTelegramBotAPI\/issues\/251#issuecomment-278531560\" rel=\"nofollow\">\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f\u043c<\/a> Telegram:<br \/> \n<pre><code class=\"python\">while True:     try:         bot.polling(none_stop=True)     except Exception as e:         time.sleep(15)<\/code><\/pre>\n<p>  <\/li>\n<\/ul>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 Telegram \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <b>8<\/b> \u043f\u043b\u0430\u0442\u0435\u0436\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c. \u0414\u043b\u044f \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u043e\u0433\u043e \u0440\u044b\u043d\u043a\u0430 \u0441\u0430\u043c\u044b\u0435 \u0445\u043e\u0434\u043e\u0432\u044b\u0435 \u044d\u0442\u043e <b>\u042f\u043d\u0434\u0435\u043a\u0441 \u041a\u0430\u0441\u0441\u0430<\/b> \u0438 <b>\u0421\u0431\u0435\u0440\u0431\u0430\u043d\u043a<\/b>. \u0421\u043e\u0432\u0435\u0442\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <b>Tranzzo<\/b>, \u0442.\u043a. \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u0440\u0442\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u043f\u0435\u0447\u0430\u0442\u043e\u043a \u043f\u0430\u043b\u044c\u0446\u0430 \u0434\u043b\u044f \u043e\u043f\u043b\u0430\u0442 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 <b>5<\/b> \u0447\u0430\u0441\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u043e\u043b\u0435\u043c.<\/p>\n<blockquote><p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e <b>token<\/b> \u043e\u0442 <b>\u0421\u0431\u0435\u0440\u0431\u0430\u043d\u043a<\/b> \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0447\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0430\u043b, \u0430 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <b>\u042f\u043d\u0434\u0435\u043a\u0441 \u041a\u0430\u0441\u0441\u044b<\/b> \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u0435 \u0437\u043d\u0430\u044e \u0441 \u0447\u0435\u043c \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e, \u043d\u043e \u0444\u0430\u043a\u0442.<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<td>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a43\/901\/d62\/a43901d62e70eb4940f739419d0588e8.gif\" width=\"250\" alt=\"image\"><\/div>\n<\/td>\n<td>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1a4\/eb1\/cd1\/1a4eb1cd12296b3abe1f19d7d42f8290.gif\" width=\"250\" alt=\"image\"><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>  <\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0441\u0442 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 mini-digital-business, \u043d\u043e \u0438 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u0448\u0435\u0432\u0435\u043b\u0438\u0442\u044c \u0432 \u0442\u0435\u0431\u0435 it \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044f, \u043d\u0430\u0447\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0438\u0434\u0435\u0438 \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b.   <\/p>\n<blockquote><p>\u0427\u0442\u043e \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b, \u0442\u043e \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b: \u0443\u0434\u0430\u0440\u043d\u0438\u043a \u2014 \u0445\u043b\u0435\u0431, \u0430 \u043b\u043e\u0434\u044b\u0440\u044c \u2014 \u043d\u0438\u0447\u0435\u0433\u043e.<\/p><\/blockquote>\n<\/div>\n<p> \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\/post\/495594\/\"> https:\/\/habr.com\/ru\/post\/495594\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/495594\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hn\/do\/t7\/hndot78f5tlzjqujos6-i7j8mnu.gif\"><\/p>\n<p>  \u0421\u0438\u0434\u044f \u043d\u0430 freelance \u0432\u0438\u0434\u0435\u043b \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043e \u0441\u0431\u043e\u0440\u0443 \u0411\u0414. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0441\u044f\u0442 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f\u0445 \u0438\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 Google, Yandex \u043a\u0430\u0440\u0442\u0430\u0445. <\/p>\n<p>  \u0415\u0441\u0442\u044c \u0441\u043f\u0440\u043e\u0441, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u043e \u043e\u0431\u043e \u0432\u0441\u0451\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\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-301261","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301261","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=301261"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301261\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=301261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=301261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=301261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}