jobstreaming 0.0.1__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.
Files changed (36) hide show
  1. jobstreaming-0.0.1/LICENSE +21 -0
  2. jobstreaming-0.0.1/PKG-INFO +291 -0
  3. jobstreaming-0.0.1/README.md +267 -0
  4. jobstreaming-0.0.1/jobstreaming/__init__.py +79 -0
  5. jobstreaming-0.0.1/jobstreaming/api.py +224 -0
  6. jobstreaming-0.0.1/jobstreaming/bayt/__init__.py +188 -0
  7. jobstreaming-0.0.1/jobstreaming/bdjobs/__init__.py +291 -0
  8. jobstreaming-0.0.1/jobstreaming/bdjobs/constant.py +32 -0
  9. jobstreaming-0.0.1/jobstreaming/bdjobs/util.py +110 -0
  10. jobstreaming-0.0.1/jobstreaming/checkpoint.py +93 -0
  11. jobstreaming-0.0.1/jobstreaming/events.py +152 -0
  12. jobstreaming-0.0.1/jobstreaming/exception.py +46 -0
  13. jobstreaming-0.0.1/jobstreaming/glassdoor/__init__.py +399 -0
  14. jobstreaming-0.0.1/jobstreaming/glassdoor/constant.py +184 -0
  15. jobstreaming-0.0.1/jobstreaming/glassdoor/util.py +51 -0
  16. jobstreaming-0.0.1/jobstreaming/google/__init__.py +276 -0
  17. jobstreaming-0.0.1/jobstreaming/google/constant.py +52 -0
  18. jobstreaming-0.0.1/jobstreaming/google/util.py +67 -0
  19. jobstreaming-0.0.1/jobstreaming/indeed/__init__.py +348 -0
  20. jobstreaming-0.0.1/jobstreaming/indeed/constant.py +109 -0
  21. jobstreaming-0.0.1/jobstreaming/indeed/util.py +92 -0
  22. jobstreaming-0.0.1/jobstreaming/linkedin/__init__.py +449 -0
  23. jobstreaming-0.0.1/jobstreaming/linkedin/constant.py +8 -0
  24. jobstreaming-0.0.1/jobstreaming/linkedin/util.py +99 -0
  25. jobstreaming-0.0.1/jobstreaming/model.py +434 -0
  26. jobstreaming-0.0.1/jobstreaming/naukri/__init__.py +321 -0
  27. jobstreaming-0.0.1/jobstreaming/naukri/constant.py +11 -0
  28. jobstreaming-0.0.1/jobstreaming/naukri/util.py +40 -0
  29. jobstreaming-0.0.1/jobstreaming/registry.py +58 -0
  30. jobstreaming-0.0.1/jobstreaming/result.py +108 -0
  31. jobstreaming-0.0.1/jobstreaming/runtime.py +540 -0
  32. jobstreaming-0.0.1/jobstreaming/util.py +401 -0
  33. jobstreaming-0.0.1/jobstreaming/ziprecruiter/__init__.py +358 -0
  34. jobstreaming-0.0.1/jobstreaming/ziprecruiter/constant.py +29 -0
  35. jobstreaming-0.0.1/jobstreaming/ziprecruiter/util.py +31 -0
  36. jobstreaming-0.0.1/pyproject.toml +61 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Cullen Watson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,291 @@
1
+ Metadata-Version: 2.4
2
+ Name: jobstreaming
3
+ Version: 0.0.1
4
+ Summary: Concurrent, resumable job search streams with a DataFrame batch API
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Keywords: jobs-scraper,streaming,linkedin,indeed,glassdoor,ziprecruiter
8
+ Author: JobStreaming contributors
9
+ Requires-Python: >=3.10,<4.0
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Requires-Dist: beautifulsoup4 (>=4.12.2,<5.0.0)
17
+ Requires-Dist: markdownify (>=1.1.0,<2.0.0)
18
+ Requires-Dist: pandas (>=2.1.0,<3.0.0)
19
+ Requires-Dist: pydantic (>=2.3.0,<3.0.0)
20
+ Requires-Dist: requests (>=2.31.0,<3.0.0)
21
+ Requires-Dist: tls-client (>=1.0.1,<2.0.0)
22
+ Description-Content-Type: text/markdown
23
+
24
+ # JobStreaming
25
+
26
+ JobStreaming is the concurrent, restartable job-collection library for JobCtrl. Its
27
+ primary API yields each job as soon as its adapter produces it, while retaining a
28
+ convenient DataFrame batch API.
29
+
30
+ This project is a heavily modified private fork of an MIT-licensed upstream project.
31
+ It retains the original license and attribution while using a completely separate
32
+ project, distribution, and import identity.
33
+
34
+ > **Alpha:** job boards change private endpoints and markup without notice. Treat every
35
+ > adapter as a best-effort integration, respect each site's terms and rate limits, and
36
+ > persist the events you need.
37
+
38
+ ## What changed
39
+
40
+ - Searches run concurrently across sites; a slow or blocked site does not hold back
41
+ healthy sites.
42
+ - Jobs, warnings, progress, site failures, and completion are typed events.
43
+ - JSON checkpoints make searches restartable with at-least-once delivery.
44
+ - Stable job identities and checkpointed deduplication prevent acknowledged jobs from
45
+ being emitted again after a restart.
46
+ - Adapter failures are isolated. The batch API returns healthy partial results unless
47
+ strict failure mode is requested.
48
+ - Requests and result models are immutable and validated.
49
+ - A `scrape_jobs(...) -> pandas.DataFrame` entry point remains available.
50
+ - Adapters are registered through an extensible registry rather than a hard-coded
51
+ dispatcher.
52
+
53
+ ```mermaid
54
+ flowchart LR
55
+ A["SearchRequest"] --> B["Concurrent coordinator"]
56
+ B --> C1["Indeed worker"]
57
+ B --> C2["LinkedIn worker"]
58
+ B --> C3["Other site workers"]
59
+ C1 --> D["Bounded event queue"]
60
+ C2 --> D
61
+ C3 --> D
62
+ D --> E["Job / progress / error events"]
63
+ E --> F["Consumer"]
64
+ F -->|"acknowledge"| G["Atomic checkpoint"]
65
+ G -->|"resume"| B
66
+ ```
67
+
68
+ ## Installation
69
+
70
+ Python 3.10 or newer is required.
71
+
72
+ Install the published package from PyPI:
73
+
74
+ ```bash
75
+ pip install -U jobstreaming
76
+ ```
77
+
78
+ Both the PyPI distribution and Python import package are `jobstreaming`. No legacy
79
+ import alias is included. The source repository remains private; PyPI releases are
80
+ performed explicitly from verified distribution artifacts.
81
+
82
+ ## Stream results immediately
83
+
84
+ ```python
85
+ from jobstreaming import ErrorEvent, JobEvent, SearchCompleteEvent, stream_search
86
+
87
+ with stream_search(
88
+ site_name=["indeed", "linkedin", "zip_recruiter"],
89
+ search_term="software engineer",
90
+ location="Madrid",
91
+ results_wanted=20, # per site
92
+ checkpoint_path=".jobstreaming/search.json",
93
+ resume=True,
94
+ ) as stream:
95
+ for event in stream:
96
+ if isinstance(event, JobEvent):
97
+ print(event.site.value, event.job.title, event.job.job_url)
98
+
99
+ # Persist the job first when durability matters, then explicitly ack it.
100
+ save_to_database(event.job)
101
+ stream.ack(event)
102
+
103
+ elif isinstance(event, ErrorEvent):
104
+ print(f"{event.site.value} failed: {event.message}")
105
+
106
+ elif isinstance(event, SearchCompleteEvent):
107
+ print("all sites completed:", event.completed)
108
+ ```
109
+
110
+ Each site runs in its own worker. Arrival order is intentionally unspecified: faster
111
+ sites and faster pages yield first.
112
+
113
+ For a job-only iterator:
114
+
115
+ ```python
116
+ from jobstreaming import stream_jobs
117
+
118
+ for job in stream_jobs(
119
+ site_name=["indeed", "google"],
120
+ search_term="data engineer",
121
+ location="Barcelona",
122
+ results_wanted=10,
123
+ ):
124
+ print(job.title)
125
+ ```
126
+
127
+ Use `stream_search` when you need errors, progress, source-site metadata, or explicit
128
+ checkpoint acknowledgements.
129
+
130
+ ## Restart and delivery semantics
131
+
132
+ Checkpointing is opt-in. Pass either `checkpoint_path` or a custom `CheckpointStore`.
133
+
134
+ - A delivered event is implicitly acknowledged when the next event is requested.
135
+ - Call `stream.ack(event)` after a durable write when you need the checkpoint advanced
136
+ immediately.
137
+ - Leaving the context manager early does not acknowledge the last delivered event;
138
+ call `stream.ack(event)` first when an intentional early stop should be committed.
139
+ - If execution stops before acknowledgement, that job can be replayed on restart. This
140
+ is at-least-once delivery: it favors avoiding data loss over pretending exactly-once
141
+ delivery is possible.
142
+ - Acknowledged jobs are deduplicated with stable, process-independent keys.
143
+ - Page and cursor state advances only after the corresponding progress event is
144
+ acknowledged.
145
+ - Recoverable adapter failures are retried once by default with exponential backoff.
146
+ Configure `max_retries` and `retry_backoff` on `stream_search` or `scrape_jobs`.
147
+ - The checkpoint is written through an `fsync` plus atomic file replacement.
148
+ - A checkpoint is bound to the complete request fingerprint. Changing the query,
149
+ filters, sites, or result count raises `CheckpointMismatchError`; use a new path or
150
+ `resume=False` for a new search.
151
+ - Board-owned cursors can expire. If a board rejects an old cursor, the stream emits an
152
+ `ErrorEvent`; restart that site from a fresh checkpoint.
153
+
154
+ If a process crashes while handling a job, replay is expected. Make downstream writes
155
+ idempotent using `event.job_key` or the job's stable `id`.
156
+
157
+ ## Compatible batch API
158
+
159
+ ```python
160
+ from jobstreaming import scrape_jobs
161
+
162
+ jobs = scrape_jobs(
163
+ site_name=["indeed", "linkedin", "zip_recruiter", "google"],
164
+ search_term="software engineer",
165
+ google_search_term="software engineer jobs near Madrid since yesterday",
166
+ location="Madrid",
167
+ results_wanted=20,
168
+ hours_old=72,
169
+ country_indeed="Spain",
170
+ )
171
+
172
+ jobs.to_csv("jobs.csv", index=False)
173
+ ```
174
+
175
+ `scrape_jobs` consumes the same concurrent event stream and returns a DataFrame. By
176
+ default, a failed site is logged and healthy partial results are returned. Set
177
+ `raise_on_error=True` to raise after all sites have had a chance to finish.
178
+
179
+ Checkpoints store identities and cursor state, not full job payloads. A resumed batch
180
+ call therefore contains only jobs emitted during that invocation. For a durable full
181
+ result set across restarts, use `stream_search` and upsert each `JobEvent` into your own
182
+ store before acknowledging it.
183
+
184
+ ## Events
185
+
186
+ `stream_search` can yield:
187
+
188
+ | Event | Meaning |
189
+ |---|---|
190
+ | `JobEvent` | One normalized job is ready. |
191
+ | `ProgressEvent` | A restart boundary such as a page or cursor was completed. |
192
+ | `WarningEvent` | A listing was skipped or a requested filter is unsupported. |
193
+ | `ErrorEvent` | A site failed; other sites continue. |
194
+ | `SiteCompleteEvent` | One site exhausted its work or reached its result limit. |
195
+ | `SearchCompleteEvent` | Every worker stopped. `completed=False` means at least one site failed. |
196
+
197
+ ## Supported sites and important limits
198
+
199
+ | Site | Restart boundary | Notes |
200
+ |---|---|---|
201
+ | Indeed | cursor/page | `hours_old`, `easy_apply`, and `job_type`/`is_remote` are mutually exclusive in the upstream API. |
202
+ | LinkedIn | result offset/page | Full descriptions require `linkedin_fetch_description=True` and add one request per job. Aggressive rate limiting is common. |
203
+ | ZipRecruiter | continuation token | US and Canada are the primary supported markets. |
204
+ | Glassdoor | page/cursor | A location is required unless `is_remote=True`. Availability depends on `country_indeed`. |
205
+ | Google Jobs | cursor | `google_search_term` can override the generated query. The upstream response format is opaque and fragile. |
206
+ | Bayt | page | Currently supports keyword search and international results. |
207
+ | Naukri | page | India-focused. A non-empty `search_term` is required. |
208
+ | BDJobs | page | Bangladesh-focused. Detail pages are fetched concurrently within each result page. |
209
+
210
+ Adapters declare their supported filters. If a selected adapter cannot honor a
211
+ requested filter, the stream emits a `WarningEvent` instead of silently implying that
212
+ the filter was applied.
213
+
214
+ ## Validated request API
215
+
216
+ For reusable searches, construct an immutable request explicitly:
217
+
218
+ ```python
219
+ from jobstreaming import Country, SearchRequest, Site, stream_search
220
+
221
+ request = SearchRequest(
222
+ site_type=(Site.INDEED, Site.LINKEDIN),
223
+ search_term="platform engineer",
224
+ location="Madrid",
225
+ country=Country.SPAIN,
226
+ results_wanted=25,
227
+ request_timeout=20,
228
+ max_pages=10,
229
+ )
230
+
231
+ with stream_search(request, checkpoint_path="search.json") as stream:
232
+ for event in stream:
233
+ ...
234
+ ```
235
+
236
+ Negative offsets/result counts, invalid timeouts, malformed compensation ranges, empty
237
+ job titles/URLs, and unsupported enum values are rejected at the boundary.
238
+
239
+ ## Custom adapters
240
+
241
+ ```python
242
+ from jobstreaming import AdapterRegistry, JobResponse, Scraper, Site, stream_search
243
+
244
+ class InternalJobs(Scraper):
245
+ def __init__(self, **kwargs):
246
+ super().__init__(Site.INDEED) # this example replaces the Indeed adapter
247
+
248
+ def scrape(self, request, context=None):
249
+ for job in fetch_internal_jobs(request):
250
+ context.emit_job(job, {"cursor": job.id})
251
+ return JobResponse()
252
+
253
+ registry = AdapterRegistry()
254
+ registry.register(Site.INDEED, InternalJobs)
255
+
256
+ with stream_search(
257
+ site_name="indeed",
258
+ registry=registry,
259
+ search_term="engineer",
260
+ ) as stream:
261
+ for event in stream:
262
+ ...
263
+ ```
264
+
265
+ Legacy adapters that only return `JobResponse` are still accepted, but their results
266
+ cannot be streamed until that adapter returns.
267
+
268
+ The registry can replace any built-in adapter. Adding an entirely new site also
269
+ requires adding that board to the `Site` enum so it participates in validation,
270
+ fingerprinting, events, and checkpoints.
271
+
272
+ ## Development
273
+
274
+ ```bash
275
+ poetry install
276
+ poetry run pytest
277
+ poetry run ruff check jobstreaming tests
278
+ poetry run black --check jobstreaming tests
279
+ poetry build
280
+ ```
281
+
282
+ The test suite is offline: it validates domain invariants, concurrency, failure
283
+ isolation, acknowledgement/replay behavior, checkpoint persistence, compatibility, and
284
+ representative adapter parsing without calling live job boards.
285
+
286
+ ## License and attribution
287
+
288
+ MIT. The retained license identifies Cullen Watson as the original copyright holder.
289
+ This rebuild is independently maintained and is not affiliated with the original
290
+ creator or any supported job board.
291
+
@@ -0,0 +1,267 @@
1
+ # JobStreaming
2
+
3
+ JobStreaming is the concurrent, restartable job-collection library for JobCtrl. Its
4
+ primary API yields each job as soon as its adapter produces it, while retaining a
5
+ convenient DataFrame batch API.
6
+
7
+ This project is a heavily modified private fork of an MIT-licensed upstream project.
8
+ It retains the original license and attribution while using a completely separate
9
+ project, distribution, and import identity.
10
+
11
+ > **Alpha:** job boards change private endpoints and markup without notice. Treat every
12
+ > adapter as a best-effort integration, respect each site's terms and rate limits, and
13
+ > persist the events you need.
14
+
15
+ ## What changed
16
+
17
+ - Searches run concurrently across sites; a slow or blocked site does not hold back
18
+ healthy sites.
19
+ - Jobs, warnings, progress, site failures, and completion are typed events.
20
+ - JSON checkpoints make searches restartable with at-least-once delivery.
21
+ - Stable job identities and checkpointed deduplication prevent acknowledged jobs from
22
+ being emitted again after a restart.
23
+ - Adapter failures are isolated. The batch API returns healthy partial results unless
24
+ strict failure mode is requested.
25
+ - Requests and result models are immutable and validated.
26
+ - A `scrape_jobs(...) -> pandas.DataFrame` entry point remains available.
27
+ - Adapters are registered through an extensible registry rather than a hard-coded
28
+ dispatcher.
29
+
30
+ ```mermaid
31
+ flowchart LR
32
+ A["SearchRequest"] --> B["Concurrent coordinator"]
33
+ B --> C1["Indeed worker"]
34
+ B --> C2["LinkedIn worker"]
35
+ B --> C3["Other site workers"]
36
+ C1 --> D["Bounded event queue"]
37
+ C2 --> D
38
+ C3 --> D
39
+ D --> E["Job / progress / error events"]
40
+ E --> F["Consumer"]
41
+ F -->|"acknowledge"| G["Atomic checkpoint"]
42
+ G -->|"resume"| B
43
+ ```
44
+
45
+ ## Installation
46
+
47
+ Python 3.10 or newer is required.
48
+
49
+ Install the published package from PyPI:
50
+
51
+ ```bash
52
+ pip install -U jobstreaming
53
+ ```
54
+
55
+ Both the PyPI distribution and Python import package are `jobstreaming`. No legacy
56
+ import alias is included. The source repository remains private; PyPI releases are
57
+ performed explicitly from verified distribution artifacts.
58
+
59
+ ## Stream results immediately
60
+
61
+ ```python
62
+ from jobstreaming import ErrorEvent, JobEvent, SearchCompleteEvent, stream_search
63
+
64
+ with stream_search(
65
+ site_name=["indeed", "linkedin", "zip_recruiter"],
66
+ search_term="software engineer",
67
+ location="Madrid",
68
+ results_wanted=20, # per site
69
+ checkpoint_path=".jobstreaming/search.json",
70
+ resume=True,
71
+ ) as stream:
72
+ for event in stream:
73
+ if isinstance(event, JobEvent):
74
+ print(event.site.value, event.job.title, event.job.job_url)
75
+
76
+ # Persist the job first when durability matters, then explicitly ack it.
77
+ save_to_database(event.job)
78
+ stream.ack(event)
79
+
80
+ elif isinstance(event, ErrorEvent):
81
+ print(f"{event.site.value} failed: {event.message}")
82
+
83
+ elif isinstance(event, SearchCompleteEvent):
84
+ print("all sites completed:", event.completed)
85
+ ```
86
+
87
+ Each site runs in its own worker. Arrival order is intentionally unspecified: faster
88
+ sites and faster pages yield first.
89
+
90
+ For a job-only iterator:
91
+
92
+ ```python
93
+ from jobstreaming import stream_jobs
94
+
95
+ for job in stream_jobs(
96
+ site_name=["indeed", "google"],
97
+ search_term="data engineer",
98
+ location="Barcelona",
99
+ results_wanted=10,
100
+ ):
101
+ print(job.title)
102
+ ```
103
+
104
+ Use `stream_search` when you need errors, progress, source-site metadata, or explicit
105
+ checkpoint acknowledgements.
106
+
107
+ ## Restart and delivery semantics
108
+
109
+ Checkpointing is opt-in. Pass either `checkpoint_path` or a custom `CheckpointStore`.
110
+
111
+ - A delivered event is implicitly acknowledged when the next event is requested.
112
+ - Call `stream.ack(event)` after a durable write when you need the checkpoint advanced
113
+ immediately.
114
+ - Leaving the context manager early does not acknowledge the last delivered event;
115
+ call `stream.ack(event)` first when an intentional early stop should be committed.
116
+ - If execution stops before acknowledgement, that job can be replayed on restart. This
117
+ is at-least-once delivery: it favors avoiding data loss over pretending exactly-once
118
+ delivery is possible.
119
+ - Acknowledged jobs are deduplicated with stable, process-independent keys.
120
+ - Page and cursor state advances only after the corresponding progress event is
121
+ acknowledged.
122
+ - Recoverable adapter failures are retried once by default with exponential backoff.
123
+ Configure `max_retries` and `retry_backoff` on `stream_search` or `scrape_jobs`.
124
+ - The checkpoint is written through an `fsync` plus atomic file replacement.
125
+ - A checkpoint is bound to the complete request fingerprint. Changing the query,
126
+ filters, sites, or result count raises `CheckpointMismatchError`; use a new path or
127
+ `resume=False` for a new search.
128
+ - Board-owned cursors can expire. If a board rejects an old cursor, the stream emits an
129
+ `ErrorEvent`; restart that site from a fresh checkpoint.
130
+
131
+ If a process crashes while handling a job, replay is expected. Make downstream writes
132
+ idempotent using `event.job_key` or the job's stable `id`.
133
+
134
+ ## Compatible batch API
135
+
136
+ ```python
137
+ from jobstreaming import scrape_jobs
138
+
139
+ jobs = scrape_jobs(
140
+ site_name=["indeed", "linkedin", "zip_recruiter", "google"],
141
+ search_term="software engineer",
142
+ google_search_term="software engineer jobs near Madrid since yesterday",
143
+ location="Madrid",
144
+ results_wanted=20,
145
+ hours_old=72,
146
+ country_indeed="Spain",
147
+ )
148
+
149
+ jobs.to_csv("jobs.csv", index=False)
150
+ ```
151
+
152
+ `scrape_jobs` consumes the same concurrent event stream and returns a DataFrame. By
153
+ default, a failed site is logged and healthy partial results are returned. Set
154
+ `raise_on_error=True` to raise after all sites have had a chance to finish.
155
+
156
+ Checkpoints store identities and cursor state, not full job payloads. A resumed batch
157
+ call therefore contains only jobs emitted during that invocation. For a durable full
158
+ result set across restarts, use `stream_search` and upsert each `JobEvent` into your own
159
+ store before acknowledging it.
160
+
161
+ ## Events
162
+
163
+ `stream_search` can yield:
164
+
165
+ | Event | Meaning |
166
+ |---|---|
167
+ | `JobEvent` | One normalized job is ready. |
168
+ | `ProgressEvent` | A restart boundary such as a page or cursor was completed. |
169
+ | `WarningEvent` | A listing was skipped or a requested filter is unsupported. |
170
+ | `ErrorEvent` | A site failed; other sites continue. |
171
+ | `SiteCompleteEvent` | One site exhausted its work or reached its result limit. |
172
+ | `SearchCompleteEvent` | Every worker stopped. `completed=False` means at least one site failed. |
173
+
174
+ ## Supported sites and important limits
175
+
176
+ | Site | Restart boundary | Notes |
177
+ |---|---|---|
178
+ | Indeed | cursor/page | `hours_old`, `easy_apply`, and `job_type`/`is_remote` are mutually exclusive in the upstream API. |
179
+ | LinkedIn | result offset/page | Full descriptions require `linkedin_fetch_description=True` and add one request per job. Aggressive rate limiting is common. |
180
+ | ZipRecruiter | continuation token | US and Canada are the primary supported markets. |
181
+ | Glassdoor | page/cursor | A location is required unless `is_remote=True`. Availability depends on `country_indeed`. |
182
+ | Google Jobs | cursor | `google_search_term` can override the generated query. The upstream response format is opaque and fragile. |
183
+ | Bayt | page | Currently supports keyword search and international results. |
184
+ | Naukri | page | India-focused. A non-empty `search_term` is required. |
185
+ | BDJobs | page | Bangladesh-focused. Detail pages are fetched concurrently within each result page. |
186
+
187
+ Adapters declare their supported filters. If a selected adapter cannot honor a
188
+ requested filter, the stream emits a `WarningEvent` instead of silently implying that
189
+ the filter was applied.
190
+
191
+ ## Validated request API
192
+
193
+ For reusable searches, construct an immutable request explicitly:
194
+
195
+ ```python
196
+ from jobstreaming import Country, SearchRequest, Site, stream_search
197
+
198
+ request = SearchRequest(
199
+ site_type=(Site.INDEED, Site.LINKEDIN),
200
+ search_term="platform engineer",
201
+ location="Madrid",
202
+ country=Country.SPAIN,
203
+ results_wanted=25,
204
+ request_timeout=20,
205
+ max_pages=10,
206
+ )
207
+
208
+ with stream_search(request, checkpoint_path="search.json") as stream:
209
+ for event in stream:
210
+ ...
211
+ ```
212
+
213
+ Negative offsets/result counts, invalid timeouts, malformed compensation ranges, empty
214
+ job titles/URLs, and unsupported enum values are rejected at the boundary.
215
+
216
+ ## Custom adapters
217
+
218
+ ```python
219
+ from jobstreaming import AdapterRegistry, JobResponse, Scraper, Site, stream_search
220
+
221
+ class InternalJobs(Scraper):
222
+ def __init__(self, **kwargs):
223
+ super().__init__(Site.INDEED) # this example replaces the Indeed adapter
224
+
225
+ def scrape(self, request, context=None):
226
+ for job in fetch_internal_jobs(request):
227
+ context.emit_job(job, {"cursor": job.id})
228
+ return JobResponse()
229
+
230
+ registry = AdapterRegistry()
231
+ registry.register(Site.INDEED, InternalJobs)
232
+
233
+ with stream_search(
234
+ site_name="indeed",
235
+ registry=registry,
236
+ search_term="engineer",
237
+ ) as stream:
238
+ for event in stream:
239
+ ...
240
+ ```
241
+
242
+ Legacy adapters that only return `JobResponse` are still accepted, but their results
243
+ cannot be streamed until that adapter returns.
244
+
245
+ The registry can replace any built-in adapter. Adding an entirely new site also
246
+ requires adding that board to the `Site` enum so it participates in validation,
247
+ fingerprinting, events, and checkpoints.
248
+
249
+ ## Development
250
+
251
+ ```bash
252
+ poetry install
253
+ poetry run pytest
254
+ poetry run ruff check jobstreaming tests
255
+ poetry run black --check jobstreaming tests
256
+ poetry build
257
+ ```
258
+
259
+ The test suite is offline: it validates domain invariants, concurrency, failure
260
+ isolation, acknowledgement/replay behavior, checkpoint persistence, compatibility, and
261
+ representative adapter parsing without calling live job boards.
262
+
263
+ ## License and attribution
264
+
265
+ MIT. The retained license identifies Cullen Watson as the original copyright holder.
266
+ This rebuild is independently maintained and is not affiliated with the original
267
+ creator or any supported job board.
@@ -0,0 +1,79 @@
1
+ from jobstreaming.api import (
2
+ build_search_request,
3
+ scrape_jobs,
4
+ stream_jobs,
5
+ stream_search,
6
+ )
7
+ from jobstreaming.checkpoint import (
8
+ CheckpointError,
9
+ CheckpointMismatchError,
10
+ JsonFileCheckpointStore,
11
+ MemoryCheckpointStore,
12
+ )
13
+ from jobstreaming.events import (
14
+ AdapterCheckpoint,
15
+ ErrorEvent,
16
+ EventType,
17
+ JobEvent,
18
+ ProgressEvent,
19
+ SearchCheckpoint,
20
+ SearchCompleteEvent,
21
+ SiteCompleteEvent,
22
+ WarningEvent,
23
+ )
24
+ from jobstreaming.model import (
25
+ AdapterCapabilities,
26
+ Compensation,
27
+ CompensationInterval,
28
+ Country,
29
+ DescriptionFormat,
30
+ JobPost,
31
+ JobResponse,
32
+ JobType,
33
+ Location,
34
+ SalarySource,
35
+ Scraper,
36
+ ScraperInput,
37
+ SearchRequest,
38
+ Site,
39
+ )
40
+ from jobstreaming.registry import AdapterRegistry, default_registry
41
+ from jobstreaming.runtime import ScrapeContext, SearchStream
42
+
43
+ __all__ = [
44
+ "AdapterCapabilities",
45
+ "AdapterCheckpoint",
46
+ "AdapterRegistry",
47
+ "CheckpointError",
48
+ "CheckpointMismatchError",
49
+ "Compensation",
50
+ "CompensationInterval",
51
+ "Country",
52
+ "DescriptionFormat",
53
+ "ErrorEvent",
54
+ "EventType",
55
+ "JobEvent",
56
+ "JobPost",
57
+ "JobResponse",
58
+ "JobType",
59
+ "JsonFileCheckpointStore",
60
+ "Location",
61
+ "MemoryCheckpointStore",
62
+ "ProgressEvent",
63
+ "SalarySource",
64
+ "ScrapeContext",
65
+ "Scraper",
66
+ "ScraperInput",
67
+ "SearchCheckpoint",
68
+ "SearchCompleteEvent",
69
+ "SearchRequest",
70
+ "SearchStream",
71
+ "Site",
72
+ "SiteCompleteEvent",
73
+ "WarningEvent",
74
+ "build_search_request",
75
+ "default_registry",
76
+ "scrape_jobs",
77
+ "stream_jobs",
78
+ "stream_search",
79
+ ]