hydrafetch 0.5.0__tar.gz → 0.6.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.5
2
2
  Name: hydrafetch
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: Official Python client for the Hydrafetch web data API. Turn any URL into clean Markdown and structured data.
5
5
  Project-URL: Homepage, https://hydrafetch.com
6
6
  Project-URL: Documentation, https://docs.hydrafetch.com
@@ -165,6 +165,19 @@ for r in res["results"]:
165
165
  print(((r.get("data") or {}).get("markdown") or "")[:500])
166
166
  ```
167
167
 
168
+ ## News
169
+
170
+ Find recent news articles about anything, newest first, each with its outlet and publish time:
171
+
172
+ ```python
173
+ found = hf.news("acme raises funding", timeRange="week", limit=10)
174
+
175
+ for article in found["results"]:
176
+ print(article["publishedAt"], article["source"], article["title"], article["url"])
177
+ ```
178
+
179
+ A news search costs 1 credit, and one that finds nothing is free. Pass `scrapeResults=True` to also read each article as clean data, at 1 extra credit per article.
180
+
168
181
  ## Jobs
169
182
 
170
183
  Search open jobs collected from company career sites and hiring platforms, by the words in the job title:
@@ -293,6 +306,7 @@ hf = Hydrafetch(
293
306
  | `markdown(url, **options)` | `str` | 1 |
294
307
  | `map(url, **options)` | links dict | 1 |
295
308
  | `search(query, **options)` | results dict | 1 + 1 per scraped result |
309
+ | `news(query, **options)` | articles, newest first | 1 + 1 per article read; free when empty |
296
310
  | `search_jobs(query, **options)` | list of jobs | 1 per 10 jobs |
297
311
  | `hiring_changes(domains, since, **options)` | list of companies | 1 per company with jobs |
298
312
  | `extract(urls, **options)` | dict with `"results"` | 5 per URL |
@@ -142,6 +142,19 @@ for r in res["results"]:
142
142
  print(((r.get("data") or {}).get("markdown") or "")[:500])
143
143
  ```
144
144
 
145
+ ## News
146
+
147
+ Find recent news articles about anything, newest first, each with its outlet and publish time:
148
+
149
+ ```python
150
+ found = hf.news("acme raises funding", timeRange="week", limit=10)
151
+
152
+ for article in found["results"]:
153
+ print(article["publishedAt"], article["source"], article["title"], article["url"])
154
+ ```
155
+
156
+ A news search costs 1 credit, and one that finds nothing is free. Pass `scrapeResults=True` to also read each article as clean data, at 1 extra credit per article.
157
+
145
158
  ## Jobs
146
159
 
147
160
  Search open jobs collected from company career sites and hiring platforms, by the words in the job title:
@@ -270,6 +283,7 @@ hf = Hydrafetch(
270
283
  | `markdown(url, **options)` | `str` | 1 |
271
284
  | `map(url, **options)` | links dict | 1 |
272
285
  | `search(query, **options)` | results dict | 1 + 1 per scraped result |
286
+ | `news(query, **options)` | articles, newest first | 1 + 1 per article read; free when empty |
273
287
  | `search_jobs(query, **options)` | list of jobs | 1 per 10 jobs |
274
288
  | `hiring_changes(domains, since, **options)` | list of companies | 1 per company with jobs |
275
289
  | `extract(urls, **options)` | dict with `"results"` | 5 per URL |
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hydrafetch"
3
- version = "0.5.0"
3
+ version = "0.6.0"
4
4
  description = "Official Python client for the Hydrafetch web data API. Turn any URL into clean Markdown and structured data."
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -4,4 +4,4 @@ from ._client import AsyncHydrafetch, Hydrafetch
4
4
  from .errors import HydrafetchError, HydrafetchTimeout
5
5
 
6
6
  __all__ = ["AsyncHydrafetch", "Hydrafetch", "HydrafetchError", "HydrafetchTimeout"]
7
- __version__ = "0.5.0"
7
+ __version__ = "0.6.0"
@@ -214,6 +214,9 @@ class Hydrafetch(_Base):
214
214
  def search(self, query: str, **options: Any) -> dict[str, Any]:
215
215
  return self._request("POST", "/v1/web/search", json={"query": query, **_drop_none(options)})
216
216
 
217
+ def news(self, query: str, **options: Any) -> dict[str, Any]:
218
+ return self._request("POST", "/v1/web/news", json={"query": query, **_drop_none(options)})
219
+
217
220
  def search_jobs(self, query: str, **options: Any) -> list[dict[str, Any]]:
218
221
  return self._request(
219
222
  "POST", "/v1/web/index/jobs/search", json={"query": query, **_drop_none(options)}
@@ -386,6 +389,11 @@ class AsyncHydrafetch(_Base):
386
389
  "POST", "/v1/web/search", json={"query": query, **_drop_none(options)}
387
390
  )
388
391
 
392
+ async def news(self, query: str, **options: Any) -> dict[str, Any]:
393
+ return await self._request(
394
+ "POST", "/v1/web/news", json={"query": query, **_drop_none(options)}
395
+ )
396
+
389
397
  async def search_jobs(self, query: str, **options: Any) -> list[dict[str, Any]]:
390
398
  return await self._request(
391
399
  "POST", "/v1/web/index/jobs/search", json={"query": query, **_drop_none(options)}
@@ -325,3 +325,13 @@ def test_hiring_changes_takes_one_domain_or_many_and_a_datetime() -> None:
325
325
  "since": "2026-10-01",
326
326
  "includeDescriptions": True,
327
327
  }
328
+
329
+
330
+ def test_news_posts_the_query_and_window() -> None:
331
+ found = {"query": "acme raises", "status": "ok", "results": [{"title": "Acme raises $10M"}]}
332
+ rec = Recorder({"success": True, "data": found})
333
+ client = make_client(rec)
334
+ out = client.news("acme raises", timeRange="day", limit=5, country=None)
335
+ assert out == found
336
+ assert rec.last.url.path == "/v1/web/news"
337
+ assert json.loads(rec.last.content) == {"query": "acme raises", "timeRange": "day", "limit": 5}
@@ -143,7 +143,7 @@ wheels = [
143
143
 
144
144
  [[package]]
145
145
  name = "hydrafetch"
146
- version = "0.5.0"
146
+ version = "0.6.0"
147
147
  source = { editable = "." }
148
148
  dependencies = [
149
149
  { name = "httpx" },
File without changes
File without changes