{"id":392401,"date":"2024-06-29T10:23:32","date_gmt":"2024-06-29T10:23:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=392401"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T10:23:32","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=392401","title":{"rendered":"<span>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 API HeadHunter \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 python<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ce9\/317\/fea\/ce9317fea377c78236d23f58ed531de6.png\" width=\"624\" height=\"468\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ce9\/317\/fea\/ce9317fea377c78236d23f58ed531de6.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441 API HeadHunter \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 python.<\/p>\n<p>\u041f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439 \u043d\u0430 \u0440\u044b\u043d\u043a\u0435 \u0442\u0440\u0443\u0434\u0430, \u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0435\u0435 \u043d\u0430\u0434\u043e \u0431\u0430\u0437\u0435 HeadHunter. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043f\u043e \u0432\u0441\u0435\u043c \u0433\u043e\u0440\u043e\u0434\u0430\u043c \u0420\u043e\u0441\u0441\u0438\u0438. \u041e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0432\u0448\u0438\u0441\u044c \u0441 <a href=\"https:\/\/github.com\/hhru\/api\" rel=\"noopener noreferrer nofollow\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043f\u043e API \u043d\u0430 github<\/u><\/a>, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c python. \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:<\/p>\n<pre><code class=\"python\">import requests      # \u0414\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e API import json          # \u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 import time          # \u0414\u043b\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u043c\u0435\u0436\u0434\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 import os            # \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 import pandas as pd  # \u0414\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 <\/code><\/pre>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0442\u0430\u043a\u043e\u0439 \u0432\u0435\u0449\u044c\u044e \u043a\u0430\u043a areas. \u0412\u0441\u0435\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 9 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0437\u043e\u043d (\u0441\u0442\u0440\u0430\u043d):<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">ID \u0441\u0442\u0440\u0430\u043d\u044b<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u044b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">5<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u043a\u0440\u0430\u0438\u043d\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">9<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0410\u0437\u0435\u0440\u0431\u0430\u0439\u0434\u0436\u0430\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">16<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u043b\u0430\u0440\u0443\u0441\u044c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">28<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0413\u0440\u0443\u0437\u0438\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">40<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u0430\u0437\u0430\u0445\u0441\u0442\u0430\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">48<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u044b\u0440\u0433\u044b\u0437\u0441\u0442\u0430\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">97<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u0437\u0431\u0435\u043a\u0438\u0441\u0442\u0430\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">113<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0420\u043e\u0441\u0441\u0438\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">1001<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u0414\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0433\u0438\u043e\u043d\u044b<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u044b \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0441\u0432\u043e\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0437\u043e\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a HH (https:\/\/api.hh.ru\/areas) \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c area \u0440\u0430\u0432\u043d\u044b\u043c ID \u0441\u0442\u0440\u0430\u043d\u044b. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0434\u043b\u044f \u0420\u043e\u0441\u0441\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0441\u0432\u044b\u0448\u0435 4 \u0442\u044b\u0441\u044f\u0447 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0433\u043e\u0440\u043e\u0434\u043e\u0432, \u0441\u0435\u043b \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432.<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0441\u0442\u0440\u0430\u043d \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c\u0438 \u0437\u043e\u043d\u0430\u043c\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u043c \u043a\u043e\u0434\u0430: <\/p>\n<pre><code class=\"python\">def getAreas():     req = requests.get('https:\/\/api.hh.ru\/areas')         data = req.content.decode()     req.close()     jsObj = json.loads(data)     areas = []     for k in jsObj:         for i in range(len(k['areas'])):             if len(k['areas'][i]['areas']) != 0:                      # \u0415\u0441\u043b\u0438 \u0443 \u0437\u043e\u043d\u044b \u0435\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0437\u043e\u043d\u044b                 for j in range(len(k['areas'][i]['areas'])):                     areas.append([k['id'],                                    k['name'],                                    k['areas'][i]['areas'][j]['id'],                                   k['areas'][i]['areas'][j]['name']])             else:                                                                # \u0415\u0441\u043b\u0438 \u0443 \u0437\u043e\u043d\u044b \u043d\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0437\u043e\u043d                 areas.append([k['id'],                                k['name'],                                k['areas'][i]['id'],                                k['areas'][i]['name']])     return areas  areas = getAreas()<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u043e\u043d\u0435 (\u0441\u0442\u0440\u0430\u043d\u0435), \u0442\u043e \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b request \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c ID \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0437\u043e\u043d\u044b, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0434\u043b\u044f \u0420\u043e\u0441\u0441\u0438\u0438: {&#8216;area&#8217;: 113}<\/p>\n<p>\u0412\u043e\u0442 \u0447\u0430\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 areas:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9b4\/763\/6e4\/9b47636e4af0da08581799f0c08228f7.png\" width=\"522\" height=\"327\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9b4\/763\/6e4\/9b47636e4af0da08581799f0c08228f7.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0441\u0442\u043e\u0438\u0442 \u043d\u0430\u0439\u0442\u0438 ID \u0440\u0430\u0431\u043e\u0442\u043e\u0434\u0430\u0442\u0435\u043b\u0435\u0439.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u043e\u0434\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438 \u0443\u0447\u0435\u0441\u0442\u044c \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043d\u0435 \u0432\u0441\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f API HH \u043d\u0430 \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a, \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0432\u043d\u0430 \u0432\u0441\u0435\u0433\u043e 2000 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. <\/p>\n<pre><code class=\"python\">def getEmployers():     req = requests.get('https:\/\/api.hh.ru\/employers')     data = req.content.decode()     req.close()     count_of_employers = json.loads(data)['found']     employers = []     i = 0     j = count_of_employers     while i &lt; j:             req = requests.get('https:\/\/api.hh.ru\/employers\/'+str(i+1))             data = req.content.decode()             req.close()             jsObj = json.loads(data)             try:                 employers.append([jsObj['id'], jsObj['name']])                 i += 1                 print([jsObj['id'], jsObj['name']])             except:                 i += 1                 j += 1             if i%200 == 0:                 time.sleep(0.2)     return employers      employers = getEmployers() <\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 employers:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/eca\/d3a\/33a\/ecad3a33a2bfa8b00c6f7a6d76d7225e.png\" width=\"496\" height=\"122\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/eca\/d3a\/33a\/ecad3a33a2bfa8b00c6f7a6d76d7225e.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 2\u0413\u0418\u0421 \u0441 ID 64174 \u0438 \u043d\u0430\u0439\u0434\u0435\u043c \u0432\u0441\u0435 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438 \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u043e\u0434\u0430\u0442\u0435\u043b\u044e \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u043e\u043d\u044b \u0420\u043e\u0441\u0441\u0438\u0438 (ID 113). \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u044e getPage \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u0437\u043e\u043d\u0443, \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438.<\/p>\n<pre><code class=\"python\">def getPage(page, area):     params = {         'employer_id': 3529,  # ID 2\u0413\u0418\u0421         'area': area,         # \u041f\u043e\u0438\u0441\u043a \u0432 \u0437\u043e\u043d\u0435         'page': page,         # \u041d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b         'per_page': 100       # \u041a\u043e\u043b-\u0432\u043e \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439 \u043d\u0430 1 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435     }        req = requests.get('https:\/\/api.hh.ru\/vacancies', params)     data = req.content.decode()      req.close()     return data<\/code><\/pre>\n<p>\u0427\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u0433\u0434\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f getPage \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"python\">for area in areas:     for page in range(0, 20):         jsObj = json.loads(getPage(page, area[2]))         if not os.path.exists('.\/areas\/'):             os.makedirs('.\/areas\/')         nextFileName = '.\/areas\/{}.json'.format(str(area[2])+'_'+str(area[3])+'_'+str(page))         f = open(nextFileName, mode='w', encoding='utf8')         f.write(json.dumps(jsObj, ensure_ascii=False))         f.close()         if (jsObj['pages'] - page) &lt;= 1:               print('[{0}\/{1}] \u041e\u0431\u043b\u0430\u0441\u0442\u044c: {3} ({2}) - {5} ({4}) \u0412\u0430\u043a\u0430\u043d\u0441\u0438\u0439: {6}'.format(area_list_id+1,                                                                           len(areas),                                                                           area[0],                                                                           area[1],                                                                           area[2],                                                                           area[3],                                                                           jsObj['found']))             break     time.sleep(0.2)<\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u043e\u043d\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0434\u043b\u044f \u0437\u043e\u043d, \u0433\u0434\u0435 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u043c \u0438\u0445 \u0432 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"python\">dt = [] for fl in os.listdir('.\/areas\/'):     f = open('.\/areas\/{}'.format(fl), encoding='utf8')     jsonText = f.read()     f.close()     jsonObj = json.loads(jsonText)     if jsonObj['found'] != 0:         for js in jsonObj['items']:             if js['salary'] != None:                 salary_from = js['salary']['from']                 salaty_to = js['salary']['to']             else:                 salary_from = None                 salaty_to = None             if js['address'] != None:                 address_raw = js['address']['raw']             else:                 address_raw = None             dt.append([                 js['id'],                 js['premium'],                 js['name'],                 js['department']['name'],                 js['has_test'],                 js['response_letter_required'],                 js['area']['id'],                 js['area']['name'],                 salary_from,                  salaty_to,                 js['type']['name'],                 address_raw,                 js['response_url'],                 js['sort_point_distance'],                 js['published_at'],                 js['created_at'],                 js['archived'],                 js['apply_alternate_url'],                 js['insider_interview'],                 js['url'],                 js['alternate_url'],                 js['relations'],                 js['employer']['id'],                 js['employer']['name'],                 js['snippet']['requirement'],                 js['snippet']['responsibility'],                 js['contacts'],                 js['schedule']['name'],                 js['working_days'],                 js['working_time_intervals'],                 js['working_time_modes'],                 js['accept_temporary']                 ])<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432 DataFrame \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043a\u0430\u043a \u0444\u0430\u0439\u043b Excel.<\/p>\n<pre><code class=\"python\">df = pd.DataFrame(dt, columns = [                                 'id',                                 'premium',                                 'name',                                 'department_name',                                 'has_test',                                 'response_letter_required',                                 'area_id',                                 'area_name',                                 'salary_from',                                  'salaty_to',                                 'type_name',                                 'address_raw',                                 'response_url',                                 'sort_point_distance',                                 'published_at',                                 'created_at',                                 'archived',                                 'apply_alternate_url',                                 'insider_interview',                                 'url',                                 'alternate_url',                                 'relations',                                 'employer_id',                                 'employer_name',                                 'snippet_requirement',                                 'snippet_responsibility',                                 'contacts',                                 'schedule_name',                                 'working_days',                                 'working_time_intervals',                                 'working_time_modes',                                 'accept_temporary'                                 ])    df.to_excel('result_2gis.xlsx')<\/code><\/pre>\n<p>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 Excel:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d4f\/118\/472\/d4f118472077290d193e98e367e97c4e.png\" width=\"624\" height=\"205\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d4f\/118\/472\/d4f118472077290d193e98e367e97c4e.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0411\u0435\u0437 \u043e\u0441\u043e\u0431\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u043e\u0434\u0430\u0442\u0435\u043b\u044e \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0435\u0440\u0440\u0438\u0442\u043e\u0440\u0438\u044f\u0445. <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0433\u0430\u0439\u0434\u0435 \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 API HeadHunter \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b API. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u044f \u0432\u0441\u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"https:\/\/github.com\/hhru\/api\" rel=\"noopener noreferrer nofollow\"><u>github HH.ru<\/u><\/a> \u0438\u043b\u0438 \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c \u043d\u0430\u0448\u0435\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043c\u0435, \u0433\u0434\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b.<\/p>\n<\/p>\n<\/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\/666062\/\"> https:\/\/habr.com\/ru\/articles\/666062\/<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441 API HeadHunter \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 python.<\/p>\n<p>\u041f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439 \u043d\u0430 \u0440\u044b\u043d\u043a\u0435 \u0442\u0440\u0443\u0434\u0430, \u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0435\u0435 \u043d\u0430\u0434\u043e \u0431\u0430\u0437\u0435 HeadHunter. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043f\u043e \u0432\u0441\u0435\u043c \u0433\u043e\u0440\u043e\u0434\u0430\u043c \u0420\u043e\u0441\u0441\u0438\u0438. \u041e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0432\u0448\u0438\u0441\u044c \u0441 <a href=\"https:\/\/github.com\/hhru\/api\" rel=\"noopener noreferrer nofollow\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043f\u043e API \u043d\u0430 github<\/u><\/a>, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c python. \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:<\/p>\n<pre><code class=\"python\">import requests      # \u0414\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e API import json          # \u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 import time          # \u0414\u043b\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u043c\u0435\u0436\u0434\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 import os            # \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 import pandas as pd  # \u0414\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 <\/code><\/pre>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0442\u0430\u043a\u043e\u0439 \u0432\u0435\u0449\u044c\u044e \u043a\u0430\u043a areas. \u0412\u0441\u0435\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 9 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0437\u043e\u043d (\u0441\u0442\u0440\u0430\u043d):<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">ID \u0441\u0442\u0440\u0430\u043d\u044b<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u044b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">5<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u043a\u0440\u0430\u0438\u043d\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">9<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0410\u0437\u0435\u0440\u0431\u0430\u0439\u0434\u0436\u0430\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">16<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u043b\u0430\u0440\u0443\u0441\u044c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">28<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0413\u0440\u0443\u0437\u0438\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">40<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u0430\u0437\u0430\u0445\u0441\u0442\u0430\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">48<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u044b\u0440\u0433\u044b\u0437\u0441\u0442\u0430\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">97<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u0437\u0431\u0435\u043a\u0438\u0441\u0442\u0430\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">113<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0420\u043e\u0441\u0441\u0438\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">1001<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u0414\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0433\u0438\u043e\u043d\u044b<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u044b \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0441\u0432\u043e\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0437\u043e\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a HH (https:\/\/api.hh.ru\/areas) \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c area \u0440\u0430\u0432\u043d\u044b\u043c ID \u0441\u0442\u0440\u0430\u043d\u044b. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0434\u043b\u044f \u0420\u043e\u0441\u0441\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0441\u0432\u044b\u0448\u0435 4 \u0442\u044b\u0441\u044f\u0447 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0433\u043e\u0440\u043e\u0434\u043e\u0432, \u0441\u0435\u043b \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432.<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0441\u0442\u0440\u0430\u043d \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c\u0438 \u0437\u043e\u043d\u0430\u043c\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u043c \u043a\u043e\u0434\u0430: <\/p>\n<pre><code class=\"python\">def getAreas():     req = requests.get('https:\/\/api.hh.ru\/areas')         data = req.content.decode()     req.close()     jsObj = json.loads(data)     areas = []     for k in jsObj:         for i in range(len(k['areas'])):             if len(k['areas'][i]['areas']) != 0:                      # \u0415\u0441\u043b\u0438 \u0443 \u0437\u043e\u043d\u044b \u0435\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0437\u043e\u043d\u044b                 for j in range(len(k['areas'][i]['areas'])):                     areas.append([k['id'],                                    k['name'],                                    k['areas'][i]['areas'][j]['id'],                                   k['areas'][i]['areas'][j]['name']])             else:                                                                # \u0415\u0441\u043b\u0438 \u0443 \u0437\u043e\u043d\u044b \u043d\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0437\u043e\u043d                 areas.append([k['id'],                                k['name'],                                k['areas'][i]['id'],                                k['areas'][i]['name']])     return areas  areas = getAreas()<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u043e\u043d\u0435 (\u0441\u0442\u0440\u0430\u043d\u0435), \u0442\u043e \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b request \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c ID \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0437\u043e\u043d\u044b, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0434\u043b\u044f \u0420\u043e\u0441\u0441\u0438\u0438: {&#8216;area&#8217;: 113}<\/p>\n<p>\u0412\u043e\u0442 \u0447\u0430\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 areas:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0441\u0442\u043e\u0438\u0442 \u043d\u0430\u0439\u0442\u0438 ID \u0440\u0430\u0431\u043e\u0442\u043e\u0434\u0430\u0442\u0435\u043b\u0435\u0439.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u043e\u0434\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438 \u0443\u0447\u0435\u0441\u0442\u044c \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043d\u0435 \u0432\u0441\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f API HH \u043d\u0430 \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a, \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0432\u043d\u0430 \u0432\u0441\u0435\u0433\u043e 2000 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. <\/p>\n<pre><code class=\"python\">def getEmployers():     req = requests.get('https:\/\/api.hh.ru\/employers')     data = req.content.decode()     req.close()     count_of_employers = json.loads(data)['found']     employers = []     i = 0     j = count_of_employers     while i &lt; j:             req = requests.get('https:\/\/api.hh.ru\/employers\/'+str(i+1))             data = req.content.decode()             req.close()             jsObj = json.loads(data)             try:                 employers.append([jsObj['id'], jsObj['name']])                 i += 1                 print([jsObj['id'], jsObj['name']])             except:                 i += 1                 j += 1             if i%200 == 0:                 time.sleep(0.2)     return employers      employers = getEmployers() <\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 employers:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 2\u0413\u0418\u0421 \u0441 ID 64174 \u0438 \u043d\u0430\u0439\u0434\u0435\u043c \u0432\u0441\u0435 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438 \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u043e\u0434\u0430\u0442\u0435\u043b\u044e \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u043e\u043d\u044b \u0420\u043e\u0441\u0441\u0438\u0438 (ID 113). \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u044e getPage \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u0437\u043e\u043d\u0443, \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438.<\/p>\n<pre><code class=\"python\">def getPage(page, area):     params = {         'employer_id': 3529,  # ID 2\u0413\u0418\u0421         'area': area,         # \u041f\u043e\u0438\u0441\u043a \u0432 \u0437\u043e\u043d\u0435         'page': page,         # \u041d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b         'per_page': 100       # \u041a\u043e\u043b-\u0432\u043e \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439 \u043d\u0430 1 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435     }        req = requests.get('https:\/\/api.hh.ru\/vacancies', params)     data = req.content.decode()      req.close()     return data<\/code><\/pre>\n<p>\u0427\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u0433\u0434\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f getPage \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"python\">for area in areas:     for page in range(0, 20):         jsObj = json.loads(getPage(page, area[2]))         if not os.path.exists('.\/areas\/'):             os.makedirs('.\/areas\/')         nextFileName = '.\/areas\/{}.json'.format(str(area[2])+'_'+str(area[3])+'_'+str(page))         f = open(nextFileName, mode='w', encoding='utf8')         f.write(json.dumps(jsObj, ensure_ascii=False))         f.close()         if (jsObj['pages'] - page) &lt;= 1:               print('[{0}\/{1}] \u041e\u0431\u043b\u0430\u0441\u0442\u044c: {3} ({2}) - {5} ({4}) \u0412\u0430\u043a\u0430\u043d\u0441\u0438\u0439: {6}'.format(area_list_id+1,                                                                           len(areas),                                                                           area[0],                                                                           area[1],                                                                           area[2],                                                                           area[3],                                                                           jsObj['found']))             break     time.sleep(0.2)<\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u043e\u043d\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0434\u043b\u044f \u0437\u043e\u043d, \u0433\u0434\u0435 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u043c \u0438\u0445 \u0432 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"python\">dt = [] for fl in os.listdir('.\/areas\/'):     f = open('.\/areas\/{}'.format(fl), encoding='utf8')     jsonText = f.read()     f.close()     jsonObj = json.loads(jsonText)     if jsonObj['found'] != 0:         for js in jsonObj['items']:             if js['salary'] != None:                 salary_from = js['salary']['from']                 salaty_to = js['salary']['to']             else:                 salary_from = None                 salaty_to = None             if js['address'] != None:                 address_raw = js['address']['raw']             else:                 address_raw = None             dt.append([                 js['id'],                 js['premium'],                 js['name'],                 js['department']['name'],                 js['has_test'],                 js['response_letter_required'],                 js['area']['id'],                 js['area']['name'],                 salary_from,                  salaty_to,                 js['type']['name'],                 address_raw,                 js['response_url'],                 js['sort_point_distance'],                 js['published_at'],                 js['created_at'],                 js['archived'],                 js['apply_alternate_url'],                 js['insider_interview'],                 js['url'],                 js['alternate_url'],                 js['relations'],                 js['employer']['id'],                 js['employer']['name'],                 js['snippet']['requirement'],                 js['snippet']['responsibility'],                 js['contacts'],                 js['schedule']['name'],                 js['working_days'],                 js['working_time_intervals'],                 js['working_time_modes'],                 js['accept_temporary']                 ])<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432 DataFrame \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043a\u0430\u043a \u0444\u0430\u0439\u043b Excel.<\/p>\n<pre><code class=\"python\">df = pd.DataFrame(dt, columns = [                                 'id',                                 'premium',                                 'name',                                 'department_name',                                 'has_test',                                 'response_letter_required',                                 'area_id',                                 'area_name',                                 'salary_from',                                  'salaty_to',                                 'type_name',                                 'address_raw',                                 'response_url',                                 'sort_point_distance',                                 'published_at',                                 'created_at',                                 'archived',                                 'apply_alternate_url',                                 'insider_interview',                                 'url',                                 'alternate_url',                                 'relations',                                 'employer_id',                                 'employer_name',                                 'snippet_requirement',                                 'snippet_responsibility',                                 'contacts',                                 'schedule_name',                                 'working_days',                                 'working_time_intervals',                                 'working_time_modes',                                 'accept_temporary'                                 ])    df.to_excel('result_2gis.xlsx')<\/code><\/pre>\n<p>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 Excel:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0411\u0435\u0437 \u043e\u0441\u043e\u0431\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u043e\u0434\u0430\u0442\u0435\u043b\u044e \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0435\u0440\u0440\u0438\u0442\u043e\u0440\u0438\u044f\u0445. <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0433\u0430\u0439\u0434\u0435 \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 API HeadHunter \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b API. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u044f \u0432\u0441\u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"https:\/\/github.com\/hhru\/api\" rel=\"noopener noreferrer nofollow\"><u>github HH.ru<\/u><\/a> \u0438\u043b\u0438 \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c \u043d\u0430\u0448\u0435\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043c\u0435, \u0433\u0434\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b.<\/p>\n<\/p>\n<\/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\/666062\/\"> https:\/\/habr.com\/ru\/articles\/666062\/<\/a><br \/><\/br><\/br><\/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-392401","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/392401","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=392401"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/392401\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=392401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=392401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=392401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}