-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
26 lines (19 loc) · 901 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from classes import Collector, DBManager
from utils import connect_or_create_db, create_tables, load_db_tables
company_names = ['LC Group', 'IBS', 'Rover', 'R-Style', 'Rosco', 'Марвел', 'Verysell', 'Yandex', 'Газпром', "Тинькофф"]
if __name__ == '__main__':
conn, cur = connect_or_create_db('hh_vacancies')
create_tables(conn, cur)
collector = Collector()
for company in company_names:
collector.add_hh_vacancies(company)
load_db_tables(cur, collector.vacancies)
conn.commit()
db_manager = DBManager(conn, cur)
# print(db_manager.get_companies_and_vacancies_count())
# print(db_manager.get_all_vacancies())
# print(db_manager.get_avg_salary())
# print(db_manager.get_vacancies_with_higher_salary())
print(db_manager.get_vacancies_with_keyword(['инженер', 'редактор']))
cur.close()
conn.close()