permtracker 0.3.0__tar.gz → 0.5.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: permtracker
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary: The PERM Tracker API from Python and the command line: DOL case status, decision estimates, the PERM queue, visa bulletins, employer, law firm and occupation records, exports, live DOL lookups and signed webhooks.
5
5
  Author-email: PERM Tracker <support@permtracker.app>
6
6
  License: MIT
@@ -17,8 +17,11 @@ The [PERM Tracker](https://permtracker.app) API for Python and the command line.
17
17
 
18
18
  - DOL case status for PERM, wage requests, H-1B LCAs, H-2A, H-2B and CW-1
19
19
  - When a pending PERM case is likely to be decided
20
+ - A case found without its number, from the employer and the filing day
20
21
  - DOL's queue and the visa bulletin
21
22
  - Employer, law firm and job records
23
+ - USCIS's I-140 and I-485 figures, and approval shares by receipt block and month
24
+ - Each consulate's interview line, the timelines people reported, and how close our estimates land
22
25
  - Exports, live DOL lookups and signed webhooks
23
26
 
24
27
  ## Install
@@ -37,6 +40,7 @@ Make a free key at [permtracker.app/settings](https://permtracker.app/settings),
37
40
  permtracker login
38
41
  permtracker case G-100-26045-123456
39
42
  permtracker estimate --filed 2026-02-15
43
+ permtracker find "Acme Corp" --filed 2026-01-30
40
44
  permtracker bulletin 2026-10
41
45
  ```
42
46
 
@@ -62,7 +66,7 @@ ok = verify_webhook(secret, request.headers, raw_body)
62
66
 
63
67
  ## If it breaks
64
68
 
65
- - **No key found:** the CLI reads `--key`, then `PERMTRACKER_API_KEY`, then the key `login` saved.
66
- - **A refused call** raises `PermTrackerError` with the API's `code`. On a rate limit, wait `retry_after` seconds.
69
+ - If no key is found: the CLI reads `--key`, then `PERMTRACKER_API_KEY`, then the key `login` saved.
70
+ - A refused call raises `PermTrackerError` with the API's `code`. On a rate limit, wait `retry_after` seconds.
67
71
 
68
72
  Full reference: [permtracker.app/developers](https://permtracker.app/developers). Terms: [permtracker.app/api-terms](https://permtracker.app/api-terms).
@@ -4,8 +4,11 @@ The [PERM Tracker](https://permtracker.app) API for Python and the command line.
4
4
 
5
5
  - DOL case status for PERM, wage requests, H-1B LCAs, H-2A, H-2B and CW-1
6
6
  - When a pending PERM case is likely to be decided
7
+ - A case found without its number, from the employer and the filing day
7
8
  - DOL's queue and the visa bulletin
8
9
  - Employer, law firm and job records
10
+ - USCIS's I-140 and I-485 figures, and approval shares by receipt block and month
11
+ - Each consulate's interview line, the timelines people reported, and how close our estimates land
9
12
  - Exports, live DOL lookups and signed webhooks
10
13
 
11
14
  ## Install
@@ -24,6 +27,7 @@ Make a free key at [permtracker.app/settings](https://permtracker.app/settings),
24
27
  permtracker login
25
28
  permtracker case G-100-26045-123456
26
29
  permtracker estimate --filed 2026-02-15
30
+ permtracker find "Acme Corp" --filed 2026-01-30
27
31
  permtracker bulletin 2026-10
28
32
  ```
29
33
 
@@ -49,7 +53,7 @@ ok = verify_webhook(secret, request.headers, raw_body)
49
53
 
50
54
  ## If it breaks
51
55
 
52
- - **No key found:** the CLI reads `--key`, then `PERMTRACKER_API_KEY`, then the key `login` saved.
53
- - **A refused call** raises `PermTrackerError` with the API's `code`. On a rate limit, wait `retry_after` seconds.
56
+ - If no key is found: the CLI reads `--key`, then `PERMTRACKER_API_KEY`, then the key `login` saved.
57
+ - A refused call raises `PermTrackerError` with the API's `code`. On a rate limit, wait `retry_after` seconds.
54
58
 
55
59
  Full reference: [permtracker.app/developers](https://permtracker.app/developers). Terms: [permtracker.app/api-terms](https://permtracker.app/api-terms).
@@ -29,7 +29,7 @@ from typing import Any, Callable, Optional
29
29
 
30
30
  __all__ = ["PermTracker", "PermTrackerError", "Answer", "CsvExport", "Usage", "verify_webhook", "WEBHOOK_EVENTS",
31
31
  "EXPORT_KINDS", "DEFAULT_BASE_URL", "__version__"]
32
- __version__ = "0.3.0"
32
+ __version__ = "0.5.0"
33
33
  WEBHOOK_EVENTS = ("case.status_changed", "employer.moved", "bulletin.published", "queue.moved", "processing_times.updated")
34
34
  EXPORT_KINDS = ("cases", "employers", "law-firms", "occupations")
35
35
  DEFAULT_BASE_URL = "https://permtracker.app/v1"
@@ -183,6 +183,32 @@ class PermTracker:
183
183
  raise PermTrackerError(400, "missing_argument", "Give a case number or a filing date.")
184
184
  return self.get("/estimate", {"case": case} if case else {"filed": filed})
185
185
 
186
+ def find_cases(
187
+ self,
188
+ employer: Optional[str] = None,
189
+ filed: Optional[str] = None,
190
+ program: Optional[str] = None,
191
+ job: Optional[str] = None,
192
+ firm: Optional[str] = None,
193
+ date_from: Optional[str] = None,
194
+ date_to: Optional[str] = None,
195
+ ) -> Answer:
196
+ """A case without its number, from what you know about it.
197
+
198
+ Any of employer, job (words of the job title) and firm (the law firm), with one
199
+ filing day (filed, YYYY-MM-DD), a range (date_from, date_to) or no date. One of
200
+ them is enough. program is perm (the default), pwd, lca or seasonal. A firm finds
201
+ decided cases only, and a range longer than three months needs an employer or a
202
+ firm. With no employer fitting in a month or less, the answer's closeNames are the
203
+ employers that filed in those days under a close spelling.
204
+ """
205
+ if not any((employer, filed, job, firm, date_from, date_to)):
206
+ raise PermTrackerError(400, "missing_argument", "Give at least one of employer, job, firm, filed, or date_from and date_to.")
207
+ return self.get(
208
+ "/cases",
209
+ {"employer": employer, "job": job, "firm": firm, "filed": filed, "from": date_from, "to": date_to, "program": program},
210
+ )
211
+
186
212
  def queue(self) -> Answer:
187
213
  return self.get("/queue")
188
214
 
@@ -217,10 +243,56 @@ class PermTracker:
217
243
  and its PERM approval rate and median wage. No key needed."""
218
244
  return self.get("/lookup/soc", {"q": q}, needs_key=False)
219
245
 
246
+ def receipt_blocks(self, form: Optional[str] = None, near: Optional[str] = None) -> Answer:
247
+ """One USCIS form's approval shares in every online receipt block (IOE and five digits) that
248
+ PERM Tracker's sample counts, each with a 95% margin. I-485 unless form says. near (a block)
249
+ keeps the 10 blocks either side of it. Counts and shares only: never a receipt number."""
250
+ return self.get("/uscis/receipt-blocks", {"form": form, "near": near})
251
+
252
+ def receipt_block(self, block: str) -> Answer:
253
+ """One receipt block (IOE09366): each form's shares, the blocks either side and the newest moves, as counts."""
254
+ return self.get("/uscis/receipt-blocks/" + urllib.parse.quote(block.strip().upper(), safe=""))
255
+
256
+ def receipt_months(self, form: Optional[str] = None) -> Answer:
257
+ """One USCIS form's approval shares by the month USCIS received the cases, newest first. I-485 unless form says."""
258
+ return self.get("/uscis/receipt-months", {"form": form})
259
+
260
+ def i140_figures(self) -> Answer:
261
+ """USCIS's own I-140 figures: the newest quarter, eight quarters by category, processing times, petitions awaiting a visa."""
262
+ return self.get("/uscis/i140")
263
+
264
+ def i485_figures(self) -> Answer:
265
+ """USCIS's own I-485 figures: the newest quarter by office, the employment-based inventory, processing times."""
266
+ return self.get("/uscis/i485")
267
+
268
+ def consulates(self) -> Answer:
269
+ """Every consulate's immigrant visa interview line, and the visas it issued in the newest 12 months."""
270
+ return self.get("/consulates")
271
+
272
+ def consulate(self, slug: str) -> Answer:
273
+ """One consulate by its slug: its line over time and its issuances each month."""
274
+ return self.get("/consulates/" + urllib.parse.quote(slug, safe=""))
275
+
276
+ def timelines(self, office: Optional[str] = None, consulate: Optional[str] = None) -> Answer:
277
+ """The timelines people reported, for everyone or for one USCIS office (three letters) or consulate (its slug). Self-reported."""
278
+ return self.get("/timelines", {"office": office, "consulate": consulate})
279
+
280
+ def accuracy(self) -> Answer:
281
+ """How close PERM Tracker's own estimates land, graded against what DOL and the State Department did."""
282
+ return self.get("/accuracy")
283
+
220
284
  def me(self) -> Answer:
221
285
  """Your key's scopes, the plan that applies, the paywall and what you've used. Not counted."""
222
286
  return self.get("/me")
223
287
 
288
+ def health(self) -> dict:
289
+ """Whether the API is up, with its description's version. No key needed, never counted."""
290
+ status, res_headers, body = self._send("/health", None, False, "GET", None, "application/json")
291
+ parsed = _parse(body)
292
+ if status >= 400:
293
+ raise _refusal(status, res_headers, parsed)
294
+ return parsed if isinstance(parsed, dict) else {}
295
+
224
296
  def export(self, kind: str, params: Optional[dict] = None) -> Answer:
225
297
  """A search's whole answer, up to the plan's export rows, as JSON. One call.
226
298
 
@@ -20,6 +20,7 @@ from . import EXPORT_KINDS, WEBHOOK_EVENTS, PermTracker, PermTrackerError, __ver
20
20
  COMMANDS = {
21
21
  "case": "one case: PERM (G-), wage request (P-), LCA (I-), H-2A, H-2B, CW-1",
22
22
  "estimate": "when a pending PERM case is likely to be decided (a number, or --filed YYYY-MM-DD)",
23
+ "find": "a case without its number, from any of: an employer, --job <words>, --firm <name>, --filed YYYY-MM-DD for one day or --from and --to for a range (--program pwd, lca or seasonal)",
23
24
  "queue": "DOL's processing times and the pending queue",
24
25
  "bulletin": "a visa bulletin, the newest by default (or YYYY-MM)",
25
26
  "employers": "search employers", "employer": "one employer by slug",
@@ -85,7 +86,12 @@ def parser() -> argparse.ArgumentParser:
85
86
  p.add_argument("args", nargs="*")
86
87
  p.add_argument("--json", action="store_true", help="print the API's own JSON")
87
88
  p.add_argument("--key", help="an API key, instead of the saved one")
88
- p.add_argument("--filed", help="a filing date, YYYY-MM-DD, for estimate")
89
+ p.add_argument("--filed", help="a filing date, YYYY-MM-DD, for estimate and find")
90
+ p.add_argument("--program", choices=["perm", "pwd", "lca", "seasonal"], help="find: the kind of filing (perm by default)")
91
+ p.add_argument("--job", help="find: words of the job title")
92
+ p.add_argument("--firm", help="find: the law firm's name (decided cases only)")
93
+ p.add_argument("--from", dest="date_from", help="find: the first filing day of a range, YYYY-MM-DD")
94
+ p.add_argument("--to", dest="date_to", help="find: the last filing day of a range, YYYY-MM-DD")
89
95
  p.add_argument("--live", action="store_true", help="case: ask DOL now when our records don't hold the number yet")
90
96
  p.add_argument("--employer", help="watch or unwatch an employer by slug")
91
97
  p.add_argument("--format", choices=["csv", "json"], help="export: csv (the default) or json")
@@ -126,6 +132,8 @@ def run(argv: list) -> int:
126
132
  return run_export(pt, a)
127
133
  if c == "case": ans = pt.case(need("a case number"), live=a.live)
128
134
  elif c == "estimate": ans = pt.estimate(filed=a.filed) if a.filed else pt.estimate(case=need("a case number, or --filed YYYY-MM-DD"))
135
+ elif c == "find":
136
+ ans = pt.find_cases(text or None, a.filed, program=a.program, job=a.job, firm=a.firm, date_from=a.date_from, date_to=a.date_to)
129
137
  elif c == "queue": ans = pt.queue()
130
138
  elif c == "bulletin": ans = pt.visa_bulletin(a.args[0] if a.args else None)
131
139
  elif c == "employers": ans = pt.employers(need("a name to search"))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: permtracker
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary: The PERM Tracker API from Python and the command line: DOL case status, decision estimates, the PERM queue, visa bulletins, employer, law firm and occupation records, exports, live DOL lookups and signed webhooks.
5
5
  Author-email: PERM Tracker <support@permtracker.app>
6
6
  License: MIT
@@ -17,8 +17,11 @@ The [PERM Tracker](https://permtracker.app) API for Python and the command line.
17
17
 
18
18
  - DOL case status for PERM, wage requests, H-1B LCAs, H-2A, H-2B and CW-1
19
19
  - When a pending PERM case is likely to be decided
20
+ - A case found without its number, from the employer and the filing day
20
21
  - DOL's queue and the visa bulletin
21
22
  - Employer, law firm and job records
23
+ - USCIS's I-140 and I-485 figures, and approval shares by receipt block and month
24
+ - Each consulate's interview line, the timelines people reported, and how close our estimates land
22
25
  - Exports, live DOL lookups and signed webhooks
23
26
 
24
27
  ## Install
@@ -37,6 +40,7 @@ Make a free key at [permtracker.app/settings](https://permtracker.app/settings),
37
40
  permtracker login
38
41
  permtracker case G-100-26045-123456
39
42
  permtracker estimate --filed 2026-02-15
43
+ permtracker find "Acme Corp" --filed 2026-01-30
40
44
  permtracker bulletin 2026-10
41
45
  ```
42
46
 
@@ -62,7 +66,7 @@ ok = verify_webhook(secret, request.headers, raw_body)
62
66
 
63
67
  ## If it breaks
64
68
 
65
- - **No key found:** the CLI reads `--key`, then `PERMTRACKER_API_KEY`, then the key `login` saved.
66
- - **A refused call** raises `PermTrackerError` with the API's `code`. On a rate limit, wait `retry_after` seconds.
69
+ - If no key is found: the CLI reads `--key`, then `PERMTRACKER_API_KEY`, then the key `login` saved.
70
+ - A refused call raises `PermTrackerError` with the API's `code`. On a rate limit, wait `retry_after` seconds.
67
71
 
68
72
  Full reference: [permtracker.app/developers](https://permtracker.app/developers). Terms: [permtracker.app/api-terms](https://permtracker.app/api-terms).
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "permtracker"
7
- version = "0.3.0"
7
+ version = "0.5.0"
8
8
  description = "The PERM Tracker API from Python and the command line: DOL case status, decision estimates, the PERM queue, visa bulletins, employer, law firm and occupation records, exports, live DOL lookups and signed webhooks."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
File without changes
File without changes