hh-applicant-tool 0.2.0__tar.gz → 0.2.2__tar.gz

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.

Potentially problematic release.


This version of hh-applicant-tool might be problematic. Click here for more details.

Files changed (23) hide show
  1. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/PKG-INFO +23 -13
  2. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/README.md +21 -12
  3. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/api/errors.py +13 -9
  4. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/constants.py +1 -1
  5. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/operations/apply_similar.py +2 -2
  6. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/operations/call_api.py +6 -4
  7. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/operations/clear_negotiations.py +2 -3
  8. hh_applicant_tool-0.2.2/hh_applicant_tool/operations/refresh_token.py +42 -0
  9. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/operations/update_resumes.py +2 -2
  10. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/operations/whoami.py +2 -2
  11. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/utils.py +5 -10
  12. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/pyproject.toml +1 -1
  13. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/__init__.py +0 -0
  14. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/__main__.py +0 -0
  15. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/api/__init__.py +0 -0
  16. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/api/client.py +0 -0
  17. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/color_log.py +0 -0
  18. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/main.py +0 -0
  19. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/operations/__init__.py +0 -0
  20. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/operations/add_handler.py +0 -0
  21. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/operations/authorize.py +0 -0
  22. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/operations/list_resumes.py +0 -0
  23. {hh_applicant_tool-0.2.0 → hh_applicant_tool-0.2.2}/hh_applicant_tool/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hh-applicant-tool
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary:
5
5
  Author: Senior YAML Developer
6
6
  Author-email: yamldeveloper@proton.me
@@ -8,13 +8,22 @@ Requires-Python: >=3.10,<4.0
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
11
12
  Requires-Dist: prettytable (>=3.6.0,<4.0.0)
12
13
  Requires-Dist: requests (>=2.28.2,<3.0.0)
13
14
  Description-Content-Type: text/markdown
14
15
 
15
16
  # HH Applicant Tool
16
17
 
17
- ![Publish to PyPI](https://github.com/s3rgeym/hh-applicant-tool/actions/workflows/publish.yml/badge.svg) [![PyPi Version](https://img.shields.io/pypi/v/hh-applicant-tool)](https://img.shields.io/pypi/v/hh-applicant-tool) [![Python Versions](https://img.shields.io/pypi/pyversions/hh-applicant-tool.svg)](https://img.shields.io/pypi/pyversions/hh-applicant-tool.svg) [![PyPI - Downloads](https://img.shields.io/pypi/dm/hh-applicant-tool)](https://img.shields.io/pypi/dm/hh-applicant-tool)
18
+ > ! Наложен мораторий на доработки/переработки. Разработка будет возобновлена после 10 звезд 💫 Вы, блять, сучары 7000 раз эту хуйню скачали и всего 5 звезд поставили. Просто охуеть! Сколько нужно скачек хотя бы ради 50 звезд?
19
+ > > Да в пизду это приложение я им не пользуюсь. Ищите работу заграницей. Нахуй вам hh? Эта страна еще 12 лет правления любителя шагов доброй лоли не выдержит
20
+
21
+ ![Publish to PyPI](https://github.com/s3rgeym/hh-applicant-tool/actions/workflows/publish.yml/badge.svg)
22
+ [![PyPi Version](https://img.shields.io/pypi/v/hh-applicant-tool)]()
23
+ [![Python Versions](https://img.shields.io/pypi/pyversions/hh-applicant-tool.svg)]()
24
+ [![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/s3rgeym/hh-applicant-tool)]()
25
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/hh-applicant-tool)]()
26
+ [![Total Downloads](https://static.pepy.tech/badge/hh-applicant-tool)]()
18
27
 
19
28
  Утилита для автоматизации действий на HH.RU таких как рассылка откликов на подходящие вакансии и обновление всех резюме.
20
29
 
@@ -110,16 +119,17 @@ https://hh.ru/employer/1918903
110
119
  - `-v` используется для вывода отладочной информации. Два таких флага, например, выводят запросы к **API**.
111
120
  - `-c <path>` можно создать путь до конфига. С помощью этого флага можно одновременно использовать несколько профилей.
112
121
 
113
- | Операция | Описание |
114
- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
115
- | **add-handler** | Добавляет обработчик протокола `hhandroid` |
116
- | **authorize** | Открывает сайт hh.ru для авторизации и перехватывает перенаправление на `hhadnroid://oauthresponse` |
117
- | **whoami** | Выводит информацию об авторизованном пользователе |
118
- | **list-resumes** | Список резюме |
119
- | **update-resumes** | Обновить все резюме. Аналогично нажатию кнопки «Обновить дату». |
120
- | **apply-similar** | Откликнуться на все подходящие вакансии. Лимит = 200 в день |
121
- | **clear-negotiations** | Удаляет отказы и отменяет заявки, которые долго висят |
122
- | **call-api** | Вызвать произвольный метод API м вывести результат. Я эту команду придумал чтобы собирать ссылки на сайты и загонять их в сканер уязвимостей. |
122
+ | Операция | Описание |
123
+ | ---------------------- | --------------------------------------------------------------------------------------------------- |
124
+ | **add-handler** | Добавляет обработчик протокола `hhandroid` |
125
+ | **authorize** | Открывает сайт hh.ru для авторизации и перехватывает перенаправление на `hhadnroid://oauthresponse` |
126
+ | **whoami** | Выводит информацию об авторизованном пользователе |
127
+ | **list-resumes** | Список резюме |
128
+ | **update-resumes** | Обновить все резюме. Аналогично нажатию кнопки «Обновить дату». |
129
+ | **apply-similar** | Откликнуться на все подходящие вакансии. Лимит = 200 в день |
130
+ | **clear-negotiations** | Удаляет отказы и отменяет заявки, которые долго висят |
131
+ | **call-api** | Вызов произвольного метода API с выводом результата. |
132
+ | **refresh-token** | Обновляет access_token. |
123
133
 
124
134
  Для начала нужно добавить обработчик протокола `hhandroid`, который используется Android-приложением для усложнения жизни честным автоматизаторам:
125
135
 
@@ -223,7 +233,7 @@ datetime.datetime(2023, 3, 23, 6, 36, 15, 596290)
223
233
  >>>
224
234
  ```
225
235
 
226
- После нужно авторизоваться по новой.
236
+ После нужно вызвать `refresh-token`.
227
237
 
228
238
  ![](https://user-images.githubusercontent.com/12753171/222870516-b29f2417-d11a-4122-8291-7d440a422a31.png)
229
239
 
@@ -1,6 +1,14 @@
1
1
  # HH Applicant Tool
2
2
 
3
- ![Publish to PyPI](https://github.com/s3rgeym/hh-applicant-tool/actions/workflows/publish.yml/badge.svg) [![PyPi Version](https://img.shields.io/pypi/v/hh-applicant-tool)](https://img.shields.io/pypi/v/hh-applicant-tool) [![Python Versions](https://img.shields.io/pypi/pyversions/hh-applicant-tool.svg)](https://img.shields.io/pypi/pyversions/hh-applicant-tool.svg) [![PyPI - Downloads](https://img.shields.io/pypi/dm/hh-applicant-tool)](https://img.shields.io/pypi/dm/hh-applicant-tool)
3
+ > ! Наложен мораторий на доработки/переработки. Разработка будет возобновлена после 10 звезд 💫 Вы, блять, сучары 7000 раз эту хуйню скачали и всего 5 звезд поставили. Просто охуеть! Сколько нужно скачек хотя бы ради 50 звезд?
4
+ > > Да в пизду это приложение я им не пользуюсь. Ищите работу заграницей. Нахуй вам hh? Эта страна еще 12 лет правления любителя шагов доброй лоли не выдержит
5
+
6
+ ![Publish to PyPI](https://github.com/s3rgeym/hh-applicant-tool/actions/workflows/publish.yml/badge.svg)
7
+ [![PyPi Version](https://img.shields.io/pypi/v/hh-applicant-tool)]()
8
+ [![Python Versions](https://img.shields.io/pypi/pyversions/hh-applicant-tool.svg)]()
9
+ [![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/s3rgeym/hh-applicant-tool)]()
10
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/hh-applicant-tool)]()
11
+ [![Total Downloads](https://static.pepy.tech/badge/hh-applicant-tool)]()
4
12
 
5
13
  Утилита для автоматизации действий на HH.RU таких как рассылка откликов на подходящие вакансии и обновление всех резюме.
6
14
 
@@ -96,16 +104,17 @@ https://hh.ru/employer/1918903
96
104
  - `-v` используется для вывода отладочной информации. Два таких флага, например, выводят запросы к **API**.
97
105
  - `-c <path>` можно создать путь до конфига. С помощью этого флага можно одновременно использовать несколько профилей.
98
106
 
99
- | Операция | Описание |
100
- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
101
- | **add-handler** | Добавляет обработчик протокола `hhandroid` |
102
- | **authorize** | Открывает сайт hh.ru для авторизации и перехватывает перенаправление на `hhadnroid://oauthresponse` |
103
- | **whoami** | Выводит информацию об авторизованном пользователе |
104
- | **list-resumes** | Список резюме |
105
- | **update-resumes** | Обновить все резюме. Аналогично нажатию кнопки «Обновить дату». |
106
- | **apply-similar** | Откликнуться на все подходящие вакансии. Лимит = 200 в день |
107
- | **clear-negotiations** | Удаляет отказы и отменяет заявки, которые долго висят |
108
- | **call-api** | Вызвать произвольный метод API м вывести результат. Я эту команду придумал чтобы собирать ссылки на сайты и загонять их в сканер уязвимостей. |
107
+ | Операция | Описание |
108
+ | ---------------------- | --------------------------------------------------------------------------------------------------- |
109
+ | **add-handler** | Добавляет обработчик протокола `hhandroid` |
110
+ | **authorize** | Открывает сайт hh.ru для авторизации и перехватывает перенаправление на `hhadnroid://oauthresponse` |
111
+ | **whoami** | Выводит информацию об авторизованном пользователе |
112
+ | **list-resumes** | Список резюме |
113
+ | **update-resumes** | Обновить все резюме. Аналогично нажатию кнопки «Обновить дату». |
114
+ | **apply-similar** | Откликнуться на все подходящие вакансии. Лимит = 200 в день |
115
+ | **clear-negotiations** | Удаляет отказы и отменяет заявки, которые долго висят |
116
+ | **call-api** | Вызов произвольного метода API с выводом результата. |
117
+ | **refresh-token** | Обновляет access_token. |
109
118
 
110
119
  Для начала нужно добавить обработчик протокола `hhandroid`, который используется Android-приложением для усложнения жизни честным автоматизаторам:
111
120
 
@@ -209,7 +218,7 @@ datetime.datetime(2023, 3, 23, 6, 36, 15, 596290)
209
218
  >>>
210
219
  ```
211
220
 
212
- После нужно авторизоваться по новой.
221
+ После нужно вызвать `refresh-token`.
213
222
 
214
223
  ![](https://user-images.githubusercontent.com/12753171/222870516-b29f2417-d11a-4122-8291-7d440a422a31.png)
215
224
 
@@ -1,7 +1,7 @@
1
- #from copy import deepcopy
1
+ # from copy import deepcopy
2
2
  from typing import Any
3
3
 
4
- from requests import Response, Request
4
+ from requests import Request, Response
5
5
  from requests.adapters import CaseInsensitiveDict
6
6
 
7
7
  __all__ = (
@@ -20,7 +20,11 @@ class ApiError(Exception):
20
20
  def __init__(self, response: Response, data: dict[str, Any]) -> None:
21
21
  self._response = response
22
22
  self._raw = data
23
-
23
+
24
+ @property
25
+ def data(self) -> dict:
26
+ return self._raw
27
+
24
28
  @property
25
29
  def request(self) -> Request:
26
30
  return self._response.request
@@ -33,11 +37,11 @@ class ApiError(Exception):
33
37
  def response_headers(self) -> CaseInsensitiveDict:
34
38
  return self._response.headers
35
39
 
36
- def __getattr__(self, name: str) -> Any:
37
- try:
38
- return self._raw[name]
39
- except KeyError as ex:
40
- raise AttributeError(name) from ex
40
+ # def __getattr__(self, name: str) -> Any:
41
+ # try:
42
+ # return self._raw[name]
43
+ # except KeyError as ex:
44
+ # raise AttributeError(name) from ex
41
45
 
42
46
  def __str__(self) -> str:
43
47
  return str(self._raw)
@@ -54,7 +58,7 @@ class ClientError(ApiError):
54
58
  class BadRequest(ClientError):
55
59
  @property
56
60
  def limit_exceeded(self) -> bool:
57
- return any(x["value"] == "limit_exceeded" for x in self.errors)
61
+ return any(x["value"] == "limit_exceeded" for x in self._raw["errors"])
58
62
 
59
63
 
60
64
  class Forbidden(ClientError):
@@ -1,4 +1,4 @@
1
- DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
1
+ DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
2
2
  ANDROID_CLIENT_ID = (
3
3
  "HIOMIAS39CA9DICTA7JIO64LQKQJF5AGIK74G9ITJKLNEDAOH5FHS5G1JI7FOEGD"
4
4
  )
@@ -8,7 +8,7 @@ from ..api import ApiClient, ApiError, BadRequest
8
8
  from ..main import BaseOperation
9
9
  from ..main import Namespace as BaseNamespace
10
10
  from ..types import ApiListResponse, VacancyItem
11
- from ..utils import truncate_string
11
+ from ..utils import print_err, truncate_string
12
12
 
13
13
  logger = logging.getLogger(__package__)
14
14
 
@@ -118,7 +118,7 @@ class Operation(BaseOperation):
118
118
  ")",
119
119
  )
120
120
  except ApiError as ex:
121
- logger.warning(ex)
121
+ print_err("❗ Ошибка:", ex)
122
122
  if isinstance(ex, BadRequest) and ex.limit_exceeded:
123
123
  break
124
124
  print("📝 Отклики на вакансии разосланы!")
@@ -1,11 +1,12 @@
1
1
  # Этот модуль можно использовать как образец для других
2
2
  import argparse
3
+ import json
3
4
  import logging
5
+ import sys
4
6
 
5
7
  from ..api import ApiClient, ApiError
6
8
  from ..main import BaseOperation
7
9
  from ..main import Namespace as BaseNamespace
8
- from ..utils import dumps
9
10
 
10
11
  logger = logging.getLogger(__package__)
11
12
 
@@ -14,6 +15,7 @@ class Namespace(BaseNamespace):
14
15
  method: str
15
16
  endpoint: str
16
17
  params: list[str]
18
+ pretty_print: bool
17
19
 
18
20
 
19
21
  class Operation(BaseOperation):
@@ -24,7 +26,7 @@ class Operation(BaseOperation):
24
26
  parser.add_argument(
25
27
  "param",
26
28
  nargs="*",
27
- help="PARAM=VALUE. Значения можно оборачивать в кавычки.",
29
+ help="PARAM=VALUE",
28
30
  default=[],
29
31
  )
30
32
  parser.add_argument(
@@ -40,7 +42,7 @@ class Operation(BaseOperation):
40
42
  params = dict(x.split("=", 1) for x in args.param)
41
43
  try:
42
44
  result = api.request(args.method, args.endpoint, params=params)
43
- print(dumps(result))
45
+ print(json.dumps(result, ensure_ascii=True))
44
46
  except ApiError as ex:
45
- logger.warning(ex)
47
+ json.dump(ex.data, sys.stderr, ensure_ascii=True)
46
48
  return 1
@@ -8,7 +8,7 @@ from ..constants import INVALID_ISO8601_FORMAT
8
8
  from ..main import BaseOperation
9
9
  from ..main import Namespace as BaseNamespace
10
10
  from ..types import ApiListResponse
11
- from ..utils import truncate_string
11
+ from ..utils import print_err, truncate_string
12
12
 
13
13
  logger = logging.getLogger(__package__)
14
14
 
@@ -100,6 +100,5 @@ class Operation(BaseOperation):
100
100
  ")",
101
101
  )
102
102
  except ClientError as ex:
103
- logger.warning(ex)
104
-
103
+ print_err("❗ Ошибка:", ex)
105
104
  print("🧹 Чистка заявок завершена!")
@@ -0,0 +1,42 @@
1
+ # Этот модуль можно использовать как образец для других
2
+ import argparse
3
+ import logging
4
+
5
+ from ..api import ApiError, OAuthClient
6
+ from ..main import BaseOperation
7
+ from ..main import Namespace as BaseNamespace
8
+ from ..utils import print_err
9
+
10
+ logger = logging.getLogger(__package__)
11
+
12
+
13
+ class Namespace(BaseNamespace):
14
+ pass
15
+
16
+
17
+ class Operation(BaseOperation):
18
+ """Получает новый access_token."""
19
+
20
+ def setup_parser(self, parser: argparse.ArgumentParser) -> None:
21
+ pass
22
+
23
+ def run(self, args: Namespace) -> None:
24
+ if (
25
+ not args.config["token"]
26
+ or not args.config["token"]["refresh_token"]
27
+ ):
28
+ print_err("❗ Необходим refresh_token!")
29
+ return 1
30
+ try:
31
+ oauth = OAuthClient(
32
+ user_agent=(
33
+ args.config["oauth_user_agent"]
34
+ or args.config["user_agent"]
35
+ ),
36
+ )
37
+ token = oauth.refresh_access(args.config["token"]["refresh_token"])
38
+ args.config.save(token=token)
39
+ print("✅ Токен обновлен!")
40
+ except ApiError as ex:
41
+ print_err("❗ Ошибка:", ex)
42
+ return 1
@@ -6,7 +6,7 @@ from ..api import ApiClient, ApiError
6
6
  from ..main import BaseOperation
7
7
  from ..main import Namespace as BaseNamespace
8
8
  from ..types import ApiListResponse
9
- from ..utils import truncate_string
9
+ from ..utils import print_err, truncate_string
10
10
 
11
11
  logger = logging.getLogger(__package__)
12
12
 
@@ -34,4 +34,4 @@ class Operation(BaseOperation):
34
34
  assert res == {}
35
35
  print("✅ Обновлено", truncate_string(resume["title"]))
36
36
  except ApiError as ex:
37
- logger.warning(ex)
37
+ print_err("❗ Ошибка:", ex)
@@ -1,11 +1,11 @@
1
1
  # Этот модуль можно использовать как образец для других
2
2
  import argparse
3
+ import json
3
4
  import logging
4
5
 
5
6
  from ..api import ApiClient
6
7
  from ..main import BaseOperation
7
8
  from ..main import Namespace as BaseNamespace
8
- from ..utils import dumps
9
9
 
10
10
  logger = logging.getLogger(__package__)
11
11
 
@@ -27,4 +27,4 @@ class Operation(BaseOperation):
27
27
  user_agent=args.config["user_agent"],
28
28
  )
29
29
  result = api.get("/me")
30
- print(dumps(result))
30
+ print(json.dumps(result, ensure_ascii=True, indent=2, sort_keys=True))
@@ -7,14 +7,7 @@ from pathlib import Path
7
7
  from threading import Lock
8
8
  from typing import Any
9
9
 
10
- print_err = partial(print, file=sys.stderr)
11
-
12
- json_dump_kwargs = dict(
13
- indent=2, ensure_ascii=False, sort_keys=True, default=str
14
- )
15
-
16
- dump = partial(json.dump, **json_dump_kwargs)
17
- dumps = partial(json.dumps, **json_dump_kwargs)
10
+ print_err = partial(print, file=sys.stderr, flush=True)
18
11
 
19
12
 
20
13
  class AttrDict(dict):
@@ -43,8 +36,10 @@ class Config(dict):
43
36
  self.update(*args, **kwargs)
44
37
  self._config_path.parent.mkdir(exist_ok=True, parents=True)
45
38
  with self._lock:
46
- with self._config_path.open("w+") as f:
47
- dump(self, f)
39
+ with self._config_path.open("w+") as fp:
40
+ json.dump(
41
+ self, fp, ensure_ascii=True, indent=2, sort_keys=True
42
+ )
48
43
 
49
44
  __getitem__ = dict.get
50
45
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "hh-applicant-tool"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  description = ""
5
5
  authors = ["Senior YAML Developer <yamldeveloper@proton.me>"]
6
6
  readme = "README.md"