π ΠΠΏΠΈΡΠ°Π½ΠΈΠ΅
ΠΡΠΎ ΡΡΠ°Π³ΠΌΠ΅Π½Ρ ΠΊΠΎΠ΄Π° Π½Π° ΡΠ·ΡΠΊΠ΅ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΡ Python. ΠΠΎΠ΄ Π½Π°ΠΏΠΈΡΠ°Π½ Π² ΡΡΠΈΠ»Π΅ ΠΠΠ ΠΈ ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅Ρ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΠΈ ΡΡΠ΅ΠΉΠΌΠ²ΠΎΡΠΊΠ° Django. Π‘ΡΠ΄Ρ ΠΏΠΎ Π²ΡΠ΅ΠΌΡ, ΡΡΠΎ ΡΠ°ΡΡΡ ΠΊΠ»Π°ΡΡΠ° `DevopsJobsFeed`, ΠΊΠΎΡΠΎΡΡΠΉ Π½Π°ΡΠ»Π΅Π΄ΡΠ΅ΡΡΡ ΠΎΡ ΠΊΠ»Π°ΡΡΠ° `Filter`. Π ΠΊΠΎΠ΄Π΅ ΠΏΡΠΈΡΡΡΡΡΠ²ΡΡΡ ΠΌΠ΅ΡΠΎΠ΄Ρ `get_jobs_list`, `get_new_jobs_list` ΠΈ `get_all_messages`.
π Π’Π΅ΠΊΡΡ Π½Π° ΠΊΠ°ΡΡΠΈΠ½ΠΊΠ΅
```
class DevopsJobsFeed(Filter):
name = 'Devops. Π Π°Π±ΠΎΡΠ° ΠΈ ΡΠ΅Π·ΡΠΌΠ΅'
url = 'https://hh.ru/vacancy/search?area=1&from=suggest_post&text=DevOps&hhtmFrom=vacancy_search_list'
description = 'ΠΡΠΆΠ½Ρ Π²Π°ΠΊΠ°Π½ΡΠΈΠΈ ΠΈ Π·Π°ΠΏΡΠΎΡΡ Π½Π° ΠΏΠΎΠΈΡΠΊ ΡΠ°Π±ΠΎΡΡ ΠΏΠΎ Π½Π°ΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ DevOps & SRE'
def get_jobs_list(self):
return self.get_all_messages(target_group=schemas.TargetGroup.objects.get(id=1))
def get_new_jobs_list(self):
return self.get_all_messages(target_group=schemas.TargetGroup.objects.get(id=1))
def get_all_messages(self, target_group):
for i in messages:
if i.text_message and target_group_id == target_group.id:
yield i
class JcIt(Filter):
name = 'Jobs. IT Π²Π°ΠΊΠ°Π½ΡΠΈΠΈ'
url = 'https://t.me/it_vacancy/4'
description = 'ΠΠΎΠΈΡΠΊ Π²Π°ΠΊΠ°Π½ΡΠΈΠΉ Π² IT'
def get_jobs_list(self):
return self.get_all_messages(target_group=schemas.TargetGroup.objects.get(id=1))
def get_new_jobs_list(self):
return self.get_all_messages(target_group=schemas.TargetGroup.objects.get(id=1))
def get_all_messages(self, target_group):
for i in messages:
if i.text_message and target_group_id == target_group.id:
yield i
factory = Totallist(target_group=schemas.TargetGroup, list=[schemas.NewJobsMessage])
@ callable(list, schemas.NewJobsFeed)
def target_group_jc_it:
return factory(JcIt)
filter = None
if filter is None:
target_group = schemas.TargetGroup.get_target_group_from_str(target_group_name)
if filter:
return filter(target_group)
```