atsfill 0.0.5.dev182__py3-none-any.whl → 0.0.5.dev184__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.
@@ -34,6 +34,8 @@ APPLY = "[data-automation=job-detail-apply]"
34
34
  CONTINUE = "[data-testid=continue-button]"
35
35
  SUBMIT = "[data-testid=review-submit-application]"
36
36
  SAVE_DETAILS = "[data-automation=personal-details-save-button]"
37
+ RESUME_FILE = "input[type=file][id^=resume]"
38
+ LETTER_FILE = "input[type=file][id^=coverLetter]"
37
39
  CHALLENGE = "Just a moment..." # Cloudflare's interstitial: it passes on its own, or on a reload
38
40
  CHALLENGE_TRIES = 2
39
41
  SIGN_IN_TIMEOUT_MS = 90_000 # SEEK's sign-in takes up to ~50 s to show its form
@@ -53,6 +55,7 @@ SUGGEST_TIMEOUT_S = 8
53
55
  POLL_MS = 250
54
56
  KEY_DELAY_MS = 40
55
57
  DETAILS = ("firstName", "lastName", "currentLocation", "phone")
58
+ DOCUMENTS = ("resume", "coverLetter", "coverLetterFile")
56
59
  VISIBILITY = ["Public", "Standard", "Limited", "Hidden"]
57
60
 
58
61
  _STEP_ONE = """() => {
@@ -62,7 +65,7 @@ _STEP_ONE = """() => {
62
65
  .find(e => e.checked);
63
66
  const label = e => e && document.querySelector(`label[for="${e.id}"]`)?.innerText.trim();
64
67
  const resume = picked('document-select');
65
- const letter = document.querySelector('[data-testid=coverLetter-method-change]');
68
+ const method = picked('coverLetter-method');
66
69
  const phone = value('#phoneNumber');
67
70
  return {
68
71
  firstName: value('#firstName'), lastName: value('#lastName'),
@@ -70,7 +73,8 @@ _STEP_ONE = """() => {
70
73
  phone: phone && code?.value
71
74
  ? `${code.options[code.selectedIndex].text.match(/\\+\\d+/)?.[0] ?? ''}${phone}` : null,
72
75
  resume: resume && resume.value !== 'dont-include' ? label(resume) : null,
73
- coverLetter: letter?.checked ? value('[data-testid=coverLetterTextInput]') : null,
76
+ coverLetter: method?.value === 'change' ? value('[data-testid=coverLetterTextInput]') : null,
77
+ coverLetterFile: method?.value === 'upload' ? label(method) : null,
74
78
  };
75
79
  }"""
76
80
 
@@ -198,7 +202,7 @@ class Jobstreet:
198
202
  self._read |= _personal_details(page, self._fields, answers)
199
203
  _documents_fill(page, answers)
200
204
  documents = page.evaluate(_STEP_ONE)
201
- self._read |= {k: documents[k] for k in ("resume", "coverLetter") if documents[k]}
205
+ self._read |= {k: documents[k] for k in DOCUMENTS if documents[k]}
202
206
  _continue(page)
203
207
  if page.url.split("?")[0].endswith("/role-requirements"):
204
208
  for field_id, answer in answers.items():
@@ -316,14 +320,12 @@ def _operations(response: Response) -> dict[str, Any]:
316
320
 
317
321
  def _documents(page: Page, viewer: dict[str, Any]) -> list[Field]:
318
322
  """The first step: the profile's personal details, then the resume and the cover letter,
319
- optional where the page offers to leave them out."""
323
+ optional where the page offers to leave them out. The cover letter is written or uploaded,
324
+ two alternatives."""
320
325
  details = viewer["personalDetails"]
321
326
  code = (details.get("countryCallingCode") or {}).get("countryCallingCode", "")
322
327
  location = (viewer.get("currentLocation2") or {}).get("description")
323
- resume = page.locator("input[type=file][id^=resume]")
324
- accept: list[str] | None = None
325
- if resume.count():
326
- accept = [str(a) for a in (resume.get_attribute("accept") or "").split(",")]
328
+ letter = not page.locator("[data-testid=coverLetter-method-none]").count()
327
329
  return [
328
330
  Field("firstName", "First name", FieldType.TEXT, True,
329
331
  prefilled=details.get("firstName") or None),
@@ -333,12 +335,21 @@ def _documents(page: Page, viewer: dict[str, Any]) -> list[Field]:
333
335
  Field("phone", "Phone number", FieldType.PHONE, False,
334
336
  prefilled=f"{code}{details['phoneNumber']}" if details.get("phoneNumber") else None),
335
337
  Field("resume", "Resumé", FieldType.FILE,
336
- not page.locator("input[type=radio][value=dont-include]").count(), accept=accept),
337
- Field("coverLetter", "Cover letter", FieldType.TEXT,
338
- not page.locator("[data-testid=coverLetter-method-none]").count()),
338
+ not page.locator("input[type=radio][value=dont-include]").count(),
339
+ accept=_accept(page, RESUME_FILE)),
340
+ Field("coverLetter", "Cover letter", FieldType.TEXT, letter, one_of="coverLetter"),
341
+ Field("coverLetterFile", "Cover letter", FieldType.FILE, letter,
342
+ accept=_accept(page, LETTER_FILE), one_of="coverLetter"),
339
343
  ] # fmt: skip
340
344
 
341
345
 
346
+ def _accept(page: Page, selector: str) -> list[str] | None:
347
+ upload = page.locator(selector)
348
+ if not upload.count():
349
+ return None
350
+ return [str(a) for a in (upload.get_attribute("accept") or "").split(",")]
351
+
352
+
342
353
  def _question(raw: dict[str, Any]) -> Field | None:
343
354
  field_id, label = f"question.{raw['id']}", raw["text"]
344
355
  options = [o["text"] for o in raw.get("options") or []]
@@ -404,20 +415,27 @@ def _phone(page: Page, answer: str) -> None:
404
415
 
405
416
  def _documents_fill(page: Page, answers: dict[str, Answer]) -> None:
406
417
  """Uploads the resume, which the page then picks, or leaves it out; the same for the cover
407
- letter, written in its box."""
418
+ letter, uploaded or written in its box."""
408
419
  if (resume := answers.get("resume")) is not None:
409
- page.locator("input[type=file][id^=resume]").set_input_files(str(resume))
410
- name = str(resume).rsplit("/", 1)[-1]
411
- page.locator("label", has_text=name).first.wait_for(timeout=SAVE_TIMEOUT_MS)
420
+ _upload(page, RESUME_FILE, str(resume))
412
421
  elif (none := page.locator("input[type=radio][value=dont-include]")).count():
413
422
  none.check(force=True)
414
- if (letter := answers.get("coverLetter")) is not None:
415
- page.locator("[data-testid=coverLetter-method-change]").check(force=True)
423
+ if (letter := answers.get("coverLetterFile")) is not None:
424
+ _upload(page, LETTER_FILE, str(letter))
425
+ elif (letter := answers.get("coverLetter")) is not None:
426
+ page.locator("input[type=radio][data-testid=coverLetter-method-change]").check(force=True)
416
427
  page.locator("[data-testid=coverLetterTextInput]").fill(str(letter))
417
428
  elif (none := page.locator("[data-testid=coverLetter-method-none]")).count():
418
429
  none.check(force=True)
419
430
 
420
431
 
432
+ def _upload(page: Page, selector: str, path: str) -> None:
433
+ """Sets the file, then waits for the radio the page adds and picks, labelled with its name."""
434
+ page.locator(selector).set_input_files(path)
435
+ name = path.rsplit("/", 1)[-1]
436
+ page.locator("label", has_text=name).first.wait_for(timeout=SAVE_TIMEOUT_MS)
437
+
438
+
421
439
  def _answer(page: Page, field: Field, answer: Answer) -> None:
422
440
  name = f"questionnaire.{field.id.removeprefix('question.')}"
423
441
  select = page.locator(f'select[name="{name}"]')
@@ -44,6 +44,7 @@ SEQ = re.compile(r"^/[a-z]{2,8}/[a-z]{2}/job/([A-Za-z0-9]+)")
44
44
  CDN = "https://cdn-prod-static.phenompeople.com/CareerConnectResources"
45
45
  FORM = "form.rjsf"
46
46
  NEXT = "button#next"
47
+ TERMS = "terms" # a notice some sites' wizard opens on, its one button accepting it
47
48
  SUBMIT = "button#submit, button.btn-submit, button[type=submit].btn-navigate:not(#next)"
48
49
  RESUME = ".resume-upload-wrapper input[type=file]"
49
50
  RESUME_ID = "resume"
@@ -264,6 +265,11 @@ class Phenom:
264
265
  SideEffect(
265
266
  "upload", "hiring_system", "the resume is uploaded to Phenom and parsed at once"
266
267
  ),
268
+ SideEffect(
269
+ "fill",
270
+ "hiring_system",
271
+ "an employer notice the wizard opens on (`page=terms`) is accepted to reach the form",
272
+ ),
267
273
  SideEffect(
268
274
  "fill",
269
275
  "hiring_system",
@@ -355,6 +361,7 @@ class Phenom:
355
361
  def fill(self, page: Page, answers: dict[str, Answer]) -> None:
356
362
  page.context.clear_cookies()
357
363
  self._open(page, fresh=True)
364
+ self._accept_terms(page)
358
365
  self._kept, self._shown = {}, {}
359
366
  if RESUME_ID in answers and page.locator(RESUME).count():
360
367
  _upload(page, _one(answers[RESUME_ID]))
@@ -414,17 +421,31 @@ class Phenom:
414
421
  if fresh or not page.url.startswith(self._apply):
415
422
  page.goto(self._apply, wait_until="domcontentloaded")
416
423
  _check_open(page)
424
+ self._wait_for_step(page)
425
+
426
+ def _wait_for_step(self, page: Page) -> None:
417
427
  try:
418
428
  page.locator(f"{FORM} {NEXT}, {FORM} button[type=submit]").first.wait_for(
419
429
  state="attached", timeout=FORM_TIMEOUT_MS
420
430
  )
421
431
  except Timeout:
422
- query = parse_qs(urlsplit(page.url).query)
423
- if step := (query.get("stepname") or query.get("page") or [None])[0]:
432
+ if step := _step_name(page.url):
424
433
  gap = known_gap(self, "first_step", f"the wizard opens on {step!r}")
425
434
  raise Unsupported(gap) from None
426
435
  raise RuntimeError("no application step on the page") from None
427
436
 
437
+ def _accept_terms(self, page: Page) -> None:
438
+ """Accepts the terms some sites' wizard opens on, a step with no field before the form."""
439
+ if _step_name(page.url) != TERMS:
440
+ return
441
+ _click(page, page.locator(FORM).locator(SUBMIT).first)
442
+ try:
443
+ page.wait_for_url(lambda url: _step_name(url) != TERMS, timeout=STEP_TIMEOUT_MS)
444
+ except Timeout:
445
+ gap = known_gap(self, "first_step", "the wizard stays on its terms once accepted")
446
+ raise Unsupported(gap) from None
447
+ self._wait_for_step(page)
448
+
428
449
  def _step(self, page: Page, answers: dict[str, Answer]) -> list[dict[str, Any]]:
429
450
  """The answered fields the current step shows, in the configuration's order."""
430
451
  shown = {r["id"]: r for r in page.locator(FORM).evaluate(_SCAN)}
@@ -1237,6 +1258,12 @@ def _seq(url: str) -> str | None:
1237
1258
  return parse_qs(parts.query).get("jobSeqNo", [None])[0]
1238
1259
 
1239
1260
 
1261
+ def _step_name(url: str) -> str | None:
1262
+ """The wizard's step as its URL names it (`stepname=`, `page=`), if it does."""
1263
+ query = parse_qs(urlsplit(url).query)
1264
+ return (query.get("stepname") or query.get("page") or [None])[0]
1265
+
1266
+
1240
1267
  def _apply_url(page: Page) -> str:
1241
1268
  """The wizard's URL: the page's, or where the job page's Apply link leads; the wizard's
1242
1269
  own when no link shows, which `_open` then finds or not."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atsfill
3
- Version: 0.0.5.dev182
3
+ Version: 0.0.5.dev184
4
4
  Summary: Read, dry-run and submit job application forms on hiring systems: Ashby, Greenhouse, Teamtailor, Welcome to the Jungle.
5
5
  Keywords: job-applications,ats,ashby,greenhouse,teamtailor,ai-agents,cli
6
6
  Author: shbernal
@@ -14,7 +14,7 @@ atsfill/adapters/hrmdirect.py,sha256=rdmbArPgm0tx4mt4wHwEdgBe-HVgh52WI59BCksp3eM
14
14
  atsfill/adapters/isolvedhire.py,sha256=c63I7MC9nsy1WvocTjFfYvCZk9kN-oc9Pfdv5Wn6MM8,29716
15
15
  atsfill/adapters/jazzhr.py,sha256=-e1Vk1S962Fuf5v3Org-Vh34CigoVNHgdYwDxyIEkqM,12446
16
16
  atsfill/adapters/jobaffinity.py,sha256=Du4od3eNXBU_1BWGfixAwOZQxLJWdQNIKh7qfv9kp_0,19792
17
- atsfill/adapters/jobstreet.py,sha256=8BlyqxdVqxDeOodnhjhONnvakCRauaoVPfY6YFa846M,22651
17
+ atsfill/adapters/jobstreet.py,sha256=9ar6gbeBtn9j5S92RZA3zoWOGj_rkrKDkIjhguj_Xcc,23427
18
18
  atsfill/adapters/join.py,sha256=hIsoZ09XuDyuof-GYPhVAIWLzE0h72PsQtLMZ-EpDmI,26740
19
19
  atsfill/adapters/lever.py,sha256=cd2UvDIF2xXzdG1X5yf2tdBs2KhSdtepfwupsyRrRpo,10965
20
20
  atsfill/adapters/manatal.py,sha256=6SMIzOGeTNK2cJEObaZDT_73V-gGDkNZjkV0L1yrfdw,17020
@@ -22,7 +22,7 @@ atsfill/adapters/oracle.py,sha256=3eIKhu7sUvk9_VL2ZBm0TdYEIyk58Br4XQW-KjZRTUo,31
22
22
  atsfill/adapters/paycor.py,sha256=k91QAI8K1a1kM-LGV-dH6G9V8DcKrhKz91aHpCAnMWc,18488
23
23
  atsfill/adapters/paylocity.py,sha256=_gjocnMpG_sDwgVPAc5MwOrtgRD4aGUBPoTy6Oot8mU,29465
24
24
  atsfill/adapters/personio.py,sha256=Bquk6KRBJSBeQTkdZVT7QRcsuWQ3Qdl4DDNNmf2M3Ew,9870
25
- atsfill/adapters/phenom.py,sha256=EbjTlO406wyaVADhfbjq31Bsvu9gJImXSMxJYQyh1u4,74789
25
+ atsfill/adapters/phenom.py,sha256=MfTxlCVhf2HoQ5FxZgnPWjOWEp8WHGm92dBleXVQspE,75893
26
26
  atsfill/adapters/pinpoint.py,sha256=g-v_qJYH1HnBLdJuYRF8B-a4IsWop4e8qAI4kl_DPGw,24426
27
27
  atsfill/adapters/recruitee.py,sha256=TsSpWoCxJcbLuxhaq6Vi0nGxnFyaskbhhb4HsfdNrD4,13415
28
28
  atsfill/adapters/recruiterflow.py,sha256=to5X2ZGPVYhZbnpxe4nZL0b3O_ZUsQ4zlEf8WzYerG8,20813
@@ -58,8 +58,8 @@ atsfill/core/snapshot.py,sha256=EeRItejCX4nZK9LPJz2rsB9WetIjNxl4cQzNFdSbCow,3615
58
58
  atsfill/core/telemetry.py,sha256=hbVDmbAWARBcoAUu9oDpybveY7DCCMKl90vPP6okG6U,8783
59
59
  atsfill/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  atsfill/registry.toml,sha256=GuLin3H0Z44rQPZjZ6OO8TKWlrkZ9iIqjJbwrrGT8go,12169
61
- atsfill-0.0.5.dev182.dist-info/licenses/LICENSE,sha256=Vp06_Ly3myMdXM2y6piv0Z3AsuWOtCQtGQwbCSvSHTo,1065
62
- atsfill-0.0.5.dev182.dist-info/WHEEL,sha256=3NO1oYsF7mANFUWVdyEQLM-zmecczWWEmmF5rEbXrWk,80
63
- atsfill-0.0.5.dev182.dist-info/entry_points.txt,sha256=REry-6FNc5M2ZD7uzjcjN7lK_Jzrjr-C5pL3NFyupnM,46
64
- atsfill-0.0.5.dev182.dist-info/METADATA,sha256=JZcPBAy2o1IEB47qgiaSM9-IT61xxAjcUs2oIAQenrI,13594
65
- atsfill-0.0.5.dev182.dist-info/RECORD,,
61
+ atsfill-0.0.5.dev184.dist-info/licenses/LICENSE,sha256=Vp06_Ly3myMdXM2y6piv0Z3AsuWOtCQtGQwbCSvSHTo,1065
62
+ atsfill-0.0.5.dev184.dist-info/WHEEL,sha256=3NO1oYsF7mANFUWVdyEQLM-zmecczWWEmmF5rEbXrWk,80
63
+ atsfill-0.0.5.dev184.dist-info/entry_points.txt,sha256=REry-6FNc5M2ZD7uzjcjN7lK_Jzrjr-C5pL3NFyupnM,46
64
+ atsfill-0.0.5.dev184.dist-info/METADATA,sha256=rAhCMY_GbR9r3NsPR_R9jQ6axyMFr6n7v5WSYr-gUok,13594
65
+ atsfill-0.0.5.dev184.dist-info/RECORD,,