{"id":294554,"date":"2019-09-11T15:00:29","date_gmt":"2019-09-11T15:00:29","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=294554"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=294554","title":{"rendered":"\u041f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u043e\u0432 \u0434\u043b\u044f \u0432\u0435\u0431-\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 e-commerce \u0441\u0430\u0439\u0442\u0430. \u0427\u0430\u0441\u0442\u044c 3: SEO-\u043a\u0430\u043d\u0430\u043b"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u0434\u0430\u0448\u0431\u043e\u0440\u0434 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 SEO-\u0442\u0440\u0430\u0444\u0438\u043a\u0430. \u0414\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043d\u0430 python \u0438 \u0447\u0435\u0440\u0435\u0437 .csv \u0444\u0430\u0439\u043b\u044b.<\/p>\n<h2>\u0427\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0442\u044c?<\/h2>\n<p>  \u0414\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0445 \u0444\u0440\u0430\u0437 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0437 <a href=\"https:\/\/webmaster.yandex.ru\/welcome\/\">\u042f\u043d\u0434\u0435\u043a\u0441.\u0412\u0435\u0431\u043c\u0430\u0441\u0442\u0435\u0440\u0430<\/a> \u0438 <a href=\"https:\/\/search.google.com\/search-console\/about\">Google Search Console<\/a>. \u0414\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u00ab\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u0438\u00bb \u043f\u0440\u043e\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0444\u0440\u0430\u0437\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0447\u0430\u0441\u0442\u043e\u0442\u043d\u043e\u0441\u0442\u0438. \u0418\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 <a href=\"https:\/\/direct.yandex.ru\">\u042f\u043d\u0434\u0435\u043a\u0441.\u0414\u0438\u0440\u0435\u043a\u0442\u0430<\/a> \u0438 <a href=\"https:\/\/ads.google.com\">Google Ads<\/a>. \u041d\u0443 \u0430 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0441\u0430\u0439\u0442\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <a href=\"https:\/\/developers.google.com\/speed\/pagespeed\/insights\/?hl=RU\">Page Speed Insider<\/a>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4g\/gs\/dk\/4ggsdkanxsmr25ycvyb84fgp5sq.png\"><br \/>  <i>\u0414\u0438\u043d\u0430\u043c\u0438\u043a\u0430 SEO-\u0442\u0440\u0430\u0444\u0438\u043a\u0430<\/i><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>Google Search Console<\/h3>\n<p>  \u0414\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 API \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <a href=\"https:\/\/github.com\/joshcarty\/google-searchconsole\">searchconsole<\/a>. \u041d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0442\u043e\u043a\u0435\u043d\u044b \u0434\u043b\u044f \u043b\u043e\u0433\u0438\u043d\u0430. \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0434\u043b\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0445 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 MS SQL \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439:<\/p>\n<pre><code class=\"python\">def google_reports(): # \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441     account = searchconsole.authenticate(client_config=r'credentials.json'                                      , credentials=r'cred_result.json')     webproperty = account['https:\/\/test.com\/'] # \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043d\u0435\u0434\u0435\u043b\u044e \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0441\u0442\u0440\u0430\u043d\u044b, \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043f\u043e\u0441\u0430\u0434\u043e\u0447\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0444\u0440\u0430\u0437\u044b     report = webproperty.query.range('today', days=-10).dimension('country', 'device', 'page', 'query').get()     now = datetime.now()     fr = now - timedelta(days = 9)     to = now - timedelta(days = 3)     res = pd.DataFrame(columns=['dt_from', 'dt_to', 'country', 'device', 'page', 'query', 'clicks', 'impressions', 'position']) # \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 DataFrame \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440     for i in report.rows:         temp={}         temp['country'] = i[0]         temp['device'] = i[1]         temp['page'] = i[2]         temp['query'] = i[3]         temp['clicks'] = i[4]         temp['impressions'] = i[5]         temp['position'] = i[7]         temp['dt_from'] = fr.strftime(\"%Y-%m-%d\")         temp['dt_to'] = to.strftime(\"%Y-%m-%d\")         res = res.append(temp, ignore_index=True)     to_sql_server(res, 'google_positions') <\/code><\/pre>\n<p>  <\/p>\n<h3>\u042f\u043d\u0434\u0435\u043a\u0441.\u0412\u0435\u0431\u043c\u0430\u0441\u0442\u0435\u0440<\/h3>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0412\u0435\u0431\u043c\u0430\u0441\u0442\u0435\u0440 \u0443\u043c\u0435\u0435\u0442 \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e 500 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0445 \u0444\u0440\u0430\u0437. \u0412\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0437\u044b \u043f\u043e \u0441\u0442\u0440\u0430\u043d\u0435, \u0442\u0438\u043f\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0442.\u043f. \u043e\u043d \u0442\u043e\u0436\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442. \u0418\u0437-\u0437\u0430 \u044d\u0442\u0438\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043f\u043e\u043c\u0438\u043c\u043e \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u043f\u043e 500 \u0441\u043b\u043e\u0432\u0430\u043c \u0438\u0437 \u0412\u0435\u0431\u043c\u0430\u0441\u0442\u0435\u0440\u0430 \u043c\u044b \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u042f\u043d\u0434\u0435\u043a\u0441.\u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u043e \u043f\u043e\u0441\u0430\u0434\u043e\u0447\u043d\u044b\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c. \u0414\u043b\u044f \u0442\u0435\u0445, \u0443 \u043a\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0445 \u0444\u0440\u0430\u0437 \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e, 500 \u0441\u043b\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0443 \u0432\u0430\u0441 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u044f\u0434\u0440\u043e \u043f\u043e \u042f\u043d\u0434\u0435\u043a\u0441\u0443 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0448\u0438\u0440\u043e\u043a\u043e\u0435, \u0442\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438\u0437 \u0438\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0438\u043b\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0430\u0440\u0441\u0435\u0440 \u043f\u043e\u0437\u0438\u0446\u0438\u0439.<\/p>\n<pre><code class=\"python\">def yandex_reports():     token = \"...\"     # \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c UserID     url = \"https:\/\/api.webmaster.yandex.net\/v4\/user\/\"     headers = {\"Authorization\": \"OAuth \" + token}     res = requests.get(url, headers=headers)     a = json.loads(res.text)     userId = a['user_id']     host_id = \"https:test.com:443\" # \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u043c 500 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0447\u0438\u0441\u043b\u0443 \u043f\u043e\u043a\u0430\u0437\u043e\u0432 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u043f\u043e\u043a\u0430\u0437\u043e\u0432     res = requests.get(url+str(userId)+\"\/hosts\/\"+host_id+\"\/search-queries\/popular\/?order_by=TOTAL_SHOWS&amp;query_indicator=TOTAL_SHOWS\", headers=headers)     df1 = pd.DataFrame(columns=['query_id', 'query_text', 'shows', 'dt_from', 'dt_to'])     a = json.loads(res.text)     for i in a['queries']:         temp={}         temp['query_id'] = i['query_id']         temp['query_text'] = i['query_text']         temp['shows'] = i['indicators']['TOTAL_SHOWS']         temp['query_text'] = i['query_text']         temp['dt_from'] = a['date_from']         temp['dt_to'] = a['date_to']         df1 = df1.append(temp, ignore_index=True)  # \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u043c 500 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0447\u0438\u0441\u043b\u0443 \u043f\u043e\u043a\u0430\u0437\u043e\u0432 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u043a\u043b\u0438\u043a\u043e\u0432     res = requests.get(url+str(userId)+\"\/hosts\/\"+host_id+\"\/search-queries\/popular\/?order_by=TOTAL_SHOWS&amp;query_indicator=TOTAL_CLICKS\", headers=headers)     df2 = pd.DataFrame(columns=['query_id', 'clicks'])     a = json.loads(res.text)     for i in a['queries']:         temp={}         temp['query_id'] = i['query_id']         temp['clicks'] = i['indicators']['TOTAL_CLICKS']         df2 = df2.append(temp, ignore_index=True)  # \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u043c 500 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0447\u0438\u0441\u043b\u0443 \u043f\u043e\u043a\u0430\u0437\u043e\u0432 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0439     res = requests.get(url+str(userId)+\"\/hosts\/\"+host_id+\"\/search-queries\/popular\/?order_by=TOTAL_SHOWS&amp;query_indicator=AVG_SHOW_POSITION\", headers=headers)     df3 = pd.DataFrame(columns=['query_id', 'position'])     a = json.loads(res.text)     for i in a['queries']:         temp={}         temp['query_id'] = i['query_id']         temp['position'] = i['indicators']['AVG_SHOW_POSITION']         df3 = df3.append(temp, ignore_index=True)      df1 = df1.merge(df2, on='query_id')     df1 = df1.merge(df3, on='query_id')     to_sql_server(df1, 'yandex_positions') <\/code><\/pre>\n<p>  <\/p>\n<h3>Page Speed Insider<\/h3>\n<p>  \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u0441\u0430\u0439\u0442\u0430. \u0415\u0441\u043b\u0438 \u0441\u0430\u0439\u0442 \u0441\u0442\u0430\u043b \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0441\u0430\u0439\u0442\u0430 \u0432 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0432\u044b\u0434\u0430\u0447\u0435. <\/p>\n<pre><code class=\"python\"># \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0442\u043e\u043f-50 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 conn = pymssql.connect(host=host,user=user,password=password)     sql_string = r'''             ;with a as(                 select distinct page, sum(clicks) as clicks                 from seo_google_positions                 group by page             )             select top 50 page from a             order by clicks desc             '''     data = pd.read_sql(sql_string, conn)     conn.close()  # \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b      dat = pd.DataFrame(columns=['first_cpu_idle', 'first_contentful_paint', 'page', 'dt'])     for i, j in data.iterrows():         url = \"https:\/\/www.googleapis.com\/pagespeedonline\/v5\/runPagespeed?url={0}&amp;category=performance&amp;strategy=desktop\".format(j[0])         res = requests.get(url)         res = json.loads(res.text)         temp = {}         temp['first_cpu_idle'] = res['lighthouseResult']['audits']['first-cpu-idle']['displayValue']         temp['first_contentful_paint'] = res['lighthouseResult']['audits']['first-contentful-paint']['displayValue']         temp['page'] = j[0]         temp['dt'] = now.strftime(\"%Y-%m-%d\")         dat = dat.append(temp, ignore_index = True)     to_sql_server(dat, 'google_pagespeed') <\/code><\/pre>\n<p>  <\/p>\n<h3>Google Ads \u0438 \u042f\u043d\u0434\u0435\u043a\u0441 \u0414\u0438\u0440\u0435\u043a\u0442<\/h3>\n<p>  \u0414\u043b\u044f \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u043c \u0447\u0430\u0441\u0442\u043e\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u0421\u0415\u041e-\u044f\u0434\u0440\u0430. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ok\/uq\/m_\/okuqm_p-umqngiofs-dm6yjwz0u.png\"><br \/>  <i>\u041f\u0440\u043e\u0433\u043d\u043e\u0437 \u0431\u044e\u0434\u0436\u0435\u0442\u0430 \u042f\u043d\u0434\u0435\u043a\u0441<\/i><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zz\/uv\/og\/zzuvogoj0zyduhf1w0by6gli4tk.png\"><br \/>  <i>\u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432 Google<\/i><\/p>\n<h3>\u042f\u043d\u0434\u0435\u043a\u0441 \u041c\u0435\u0442\u0440\u0438\u043a\u0430<\/h3>\n<p>  \u0412\u044b\u0433\u0440\u0443\u0437\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430\u043c \u0438 \u0432\u0438\u0437\u0438\u0442\u0430\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432\u0445\u043e\u0434\u0430 \u0441 SEO-\u0442\u0440\u0430\u0444\u0438\u043a\u0430. <\/p>\n<pre><code class=\"python\">token = token     headers = {\"Authorization\": \"OAuth \" + token}     now = datetime.now()     fr = (now - timedelta(days = 9)).strftime(\"%Y-%m-%d\")     to = (now - timedelta(days = 3)).strftime(\"%Y-%m-%d\")     res = requests.get(\"https:\/\/api-metrika.yandex.net\/stat\/v1\/data\/?ids=ids&amp;metrics=ym:s:pageviews,ym:s:visits&amp;dimensions=ym:s:startURL,ym:s:lastsignSearchEngine,ym:s:regionCountry,ym:s:deviceCategory&amp;date1={0}&amp;date2={1}&amp;group=all&amp;filters=ym:s:lastsignTrafficSource=='organic'&amp;limit=50000\".format(fr,to),                             headers=headers)     a = json.loads(res.text)     re = pd.DataFrame(columns=['page', 'device', 'view', 'dt_from', 'dt_to', 'engine', 'visits', 'country', 'pageviews'])     for i in a['data']:         temp={}         temp['page'] = i['dimensions'][0]['name']         temp['engine'] = i['dimensions'][1]['name']         temp['country'] = i['dimensions'][2]['name']         temp['device'] = i['dimensions'][3]['name']         temp['view'] = i['metrics'][0]         temp['visits'] = i['metrics'][1]         temp['pageviews'] = i['metrics'][0]         temp['dt_from'] = fr         temp['dt_to'] = to         re=re.append(temp, ignore_index=True)     to_sql_server(re, 'yandex_pages') <\/code><\/pre>\n<p>  <\/p>\n<h2>\u0421\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Power BI<\/h2>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c:<\/p>\n<ul>\n<li>google_positions \u0438 yandex_positions<\/li>\n<li>google_frequency \u0438 yandex_frequency<\/li>\n<li>google_speed \u0438 yandex_speed<\/li>\n<li>yandex_metrika<\/li>\n<\/ul>\n<p>  \u0418\u0437 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0443 \u043f\u043e \u043d\u0435\u0434\u0435\u043b\u044f\u043c, \u043f\u043e \u0441\u0435\u0433\u043c\u0430\u043d\u0442\u0430\u043c, \u043e\u0431\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u043c \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c, \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0443 \u0438 \u043e\u0431\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430. \u0412\u043e\u0442 \u0442\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0447\u0435\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qm\/il\/8h\/qmil8hituhui7vmm2-gj7sy_spa.png\"><\/p>\n<p>  \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0447\u0435\u043a \u0438 \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u043e\u0432\u044b \u043e\u0431\u0449\u0438\u0435 \u0442\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u0438. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044b \u0432\u0430\u0436\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u043c, \u043f\u043e\u043a\u0430\u0437\u0430\u043c, \u043a\u043b\u0438\u043a\u0430\u043c, CTR, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. <\/p>\n<p>  \u0421\u0442\u0430\u0442\u044c\u0438 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430:<\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/post\/422235\/\">\u041f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u043e\u0432 \u0434\u043b\u044f \u0432\u0435\u0431-\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 e-commerce \u0441\u0430\u0439\u0442\u0430. \u0427\u0430\u0441\u0442\u044c 1: \u0423\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/post\/422369\/\">\u041f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u043e\u0432 \u0434\u043b\u044f \u0432\u0435\u0431-\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 e-commerce \u0441\u0430\u0439\u0442\u0430. \u0427\u0430\u0441\u0442\u044c 2: Email-\u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0438. \u0421\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0434\u0430\u0448\u0431\u043e\u0440\u0434<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/422825\/\">\u041f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u043e\u0432 \u0434\u043b\u044f \u0432\u0435\u0431-\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 e-commerce \u0441\u0430\u0439\u0442\u0430. \u0427\u0430\u0441\u0442\u044c 2: Email-\u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0438. \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0434\u0430\u0448\u0431\u043e\u0440\u0434<\/a><\/li>\n<\/ul>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <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\/post\/467019\/\"> https:\/\/habr.com\/ru\/post\/467019\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u0434\u0430\u0448\u0431\u043e\u0440\u0434 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 SEO-\u0442\u0440\u0430\u0444\u0438\u043a\u0430. \u0414\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043d\u0430 python \u0438 \u0447\u0435\u0440\u0435\u0437 .csv \u0444\u0430\u0439\u043b\u044b.<\/p>\n<h2>\u0427\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0442\u044c?<\/h2>\n<p>  \u0414\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0445 \u0444\u0440\u0430\u0437 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0437 <a href=\"https:\/\/webmaster.yandex.ru\/welcome\/\">\u042f\u043d\u0434\u0435\u043a\u0441.\u0412\u0435\u0431\u043c\u0430\u0441\u0442\u0435\u0440\u0430<\/a> \u0438 <a href=\"https:\/\/search.google.com\/search-console\/about\">Google Search Console<\/a>. \u0414\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u00ab\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u0438\u00bb \u043f\u0440\u043e\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0444\u0440\u0430\u0437\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0447\u0430\u0441\u0442\u043e\u0442\u043d\u043e\u0441\u0442\u0438. \u0418\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 <a href=\"https:\/\/direct.yandex.ru\">\u042f\u043d\u0434\u0435\u043a\u0441.\u0414\u0438\u0440\u0435\u043a\u0442\u0430<\/a> \u0438 <a href=\"https:\/\/ads.google.com\">Google Ads<\/a>. \u041d\u0443 \u0430 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0441\u0430\u0439\u0442\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <a href=\"https:\/\/developers.google.com\/speed\/pagespeed\/insights\/?hl=RU\">Page Speed Insider<\/a>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4g\/gs\/dk\/4ggsdkanxsmr25ycvyb84fgp5sq.png\"><br \/>  <i>\u0414\u0438\u043d\u0430\u043c\u0438\u043a\u0430 SEO-\u0442\u0440\u0430\u0444\u0438\u043a\u0430<\/i>  <\/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-294554","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/294554","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=294554"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/294554\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=294554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=294554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=294554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}