hh-applicant-tool 0.6.1__py3-none-any.whl → 0.6.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,11 +13,13 @@ from ..mixins import GetResumeIdMixin
13
13
  from ..utils import parse_interval, random_text
14
14
  from ..telemetry_client import TelemetryClient, TelemetryError
15
15
  import re
16
+ from itertools import count
16
17
 
17
18
  try:
18
19
  import readline
19
20
 
20
21
  readline.add_history("/cancel ")
22
+ readline.add_history("/ban")
21
23
  readline.set_history_length(10_000)
22
24
  except ImportError:
23
25
  pass
@@ -100,7 +102,18 @@ class Operation(BaseOperation, GetResumeIdMixin):
100
102
  logger.debug(f"{self.reply_message = }")
101
103
  self._reply_chats()
102
104
 
105
+ def _get_blacklisted(self) -> list[str]:
106
+ rv = []
107
+ for page in count(0):
108
+ r = self.api_client.get("/employers/blacklisted", page=page)
109
+ rv += [item["id"] for item in r["items"]]
110
+ if page >= r["pages"]:
111
+ break
112
+ return rv
113
+
103
114
  def _reply_chats(self) -> None:
115
+ blacklisted = self._get_blacklisted()
116
+ logger.debug(f"{blacklisted = }")
104
117
  me = self.me = self.api_client.get("/me")
105
118
 
106
119
  telemetry_data = {"links": []}
@@ -130,11 +143,19 @@ class Operation(BaseOperation, GetResumeIdMixin):
130
143
  logger.debug(negotiation)
131
144
  nid = negotiation["id"]
132
145
  vacancy = negotiation["vacancy"]
146
+ employer = vacancy.get("employer") or {}
133
147
  salary = vacancy.get("salary") or {}
134
148
 
149
+ if employer.get("id") in blacklisted:
150
+ print(
151
+ "🚫 Пропускаем заблокированного работодателя",
152
+ employer.get("alternate_url"),
153
+ )
154
+ continue
155
+
135
156
  message_placeholders = {
136
157
  "vacancy_name": vacancy.get("name", ""),
137
- "employer_name": vacancy.get("employer", {}).get("name", ""),
158
+ "employer_name": employer.get("name", ""),
138
159
  **basic_message_placeholders,
139
160
  }
140
161
 
@@ -229,13 +250,14 @@ class Operation(BaseOperation, GetResumeIdMixin):
229
250
  print("-" * 10)
230
251
  print()
231
252
  print(
232
- "Чтобы отменить отклик введите /cancel <необязательное сообщение для отказа>"
253
+ "Отмена отклика: /cancel <необязательное сообщение для отказа>"
233
254
  )
255
+ print("Заблокировать работодателя: /ban")
234
256
  print()
235
257
  send_message = input("Ваше сообщение: ").strip()
236
258
  except EOFError:
237
259
  continue
238
- if not message:
260
+ if not send_message:
239
261
  print("🚶 Пропускаем чат")
240
262
  continue
241
263
 
@@ -254,13 +276,20 @@ class Operation(BaseOperation, GetResumeIdMixin):
254
276
  )
255
277
  )
256
278
 
257
- if send_message.startswith("/cancel"):
279
+ if send_message.startswith("/ban"):
280
+ self.api_client.put(f"/employers/blacklisted/{employer['id']}")
281
+ blacklisted.append(employer["id"])
282
+ print(
283
+ "🚫 Работодатель добавлен в черный список",
284
+ employer.get("alternate_url"),
285
+ )
286
+ elif send_message.startswith("/cancel"):
258
287
  _, decline_allowed = send_message.split("/cancel", 1)
259
288
  self.api_client.delete(
260
289
  f"/negotiations/active/{negotiation['id']}",
261
290
  with_decline_message=decline_allowed.strip(),
262
291
  )
263
- print("Отменили заявку", vacancy["alternate_url"])
292
+ print("Отменили заявку", vacancy["alternate_url"])
264
293
  else:
265
294
  self.api_client.post(
266
295
  f"/negotiations/{nid}/messages",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hh-applicant-tool
3
- Version: 0.6.1
3
+ Version: 0.6.3
4
4
  Summary:
5
5
  Author: Senior YAML Developer
6
6
  Author-email: yamldeveloper@proton.me
@@ -20,13 +20,13 @@ hh_applicant_tool/operations/delete_telemetry.py,sha256=JHdh_l7IJL_qy5AIIy8FQpUu
20
20
  hh_applicant_tool/operations/get_employer_contacts.py,sha256=Sd-x3O08bmKm1OGVLtJ6rcPZ_j1jwjlqKV4z1n_G-38,9918
21
21
  hh_applicant_tool/operations/list_resumes.py,sha256=dILHyBCSEVqdNAvD8SML5f2Lau1R2AzTaKE9B4FG8Wg,1109
22
22
  hh_applicant_tool/operations/refresh_token.py,sha256=v_Fcw9mCfOdE6MLTCQjZQudhJPX0fup3k0BaIM394Qw,834
23
- hh_applicant_tool/operations/reply_employers.py,sha256=MXJQi-GtNS5qvzXLAs6lCQAts2C95erkLhKlJjOgmU4,12141
23
+ hh_applicant_tool/operations/reply_employers.py,sha256=eJlVuliQO_fy7_sBj-1RqgjphqbqP_yejbNFVxiUhNM,13426
24
24
  hh_applicant_tool/operations/update_resumes.py,sha256=_r7HA_vpYMs5DFY-mVP1ZRG9bggsv7ebKYrwteBmJ30,1053
25
25
  hh_applicant_tool/operations/whoami.py,sha256=pNWJMmEQLBk3U6eiGz4CHcX7eXzDXcfezFjX7zLjqyA,711
26
26
  hh_applicant_tool/telemetry_client.py,sha256=1EKZWc5kMx2yERW9SrR9vaf-OB6M_KKcMXeicH5YyY0,3834
27
27
  hh_applicant_tool/types.py,sha256=q3yaIcq-UOkPzjxws0OFa4w9fTty-yx79_dic70_dUM,843
28
28
  hh_applicant_tool/utils.py,sha256=3T4A2AykGqTwtGAttmYplIjHwFl3pNAcbWIVuA-OheQ,3080
29
- hh_applicant_tool-0.6.1.dist-info/METADATA,sha256=V7CpXjaY9umtZo_DT70WEQMfe25CvxMk14RpL-6Dndc,20600
30
- hh_applicant_tool-0.6.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
31
- hh_applicant_tool-0.6.1.dist-info/entry_points.txt,sha256=Vb7M2YaYLMtKYJZh8chIrXZApMzSRFT1-rQw-U9r10g,65
32
- hh_applicant_tool-0.6.1.dist-info/RECORD,,
29
+ hh_applicant_tool-0.6.3.dist-info/METADATA,sha256=kBijByhrEeWXEBq6dNd6Y4x_LScU9kC1dW-_yPWhSFo,20600
30
+ hh_applicant_tool-0.6.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
31
+ hh_applicant_tool-0.6.3.dist-info/entry_points.txt,sha256=Vb7M2YaYLMtKYJZh8chIrXZApMzSRFT1-rQw-U9r10g,65
32
+ hh_applicant_tool-0.6.3.dist-info/RECORD,,