Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"cliVersion": "5.45.3",
"cliVersion": "5.50.6",
"generatorName": "fernapi/fern-python-sdk",
"generatorVersion": "5.14.12",
"generatorVersion": "5.14.21",
"generatorConfig": {
"package_name": "newscatcher_catchall",
"client": {
"class_name": "CatchAllApi",
"filename": "client.py"
}
},
"originGitCommit": "56ea60da11c1b8d90274a137f5fbc3bb89b9fac4",
"originGitCommit": "f9a7ba07dda24e9d9936bb543686bc542355479e",
"originGitCommitIsDirty": true,
"invokedBy": "ci",
"requestedVersion": "AUTO",
"ciProvider": "unknown",
"sdkVersion": "3.0.1"
"sdkVersion": "0.0.0.dev0"
}
8 changes: 7 additions & 1 deletion .fern/replay.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,4 @@ On the other hand, contributions to the README are always very welcome!




20 changes: 10 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dynamic = ["version"]

[tool.poetry]
name = "newscatcher-catchall-sdk"
version = "3.0.1"
version = "0.0.0.dev0"
description = ""
readme = "README.md"
authors = []
Expand Down Expand Up @@ -38,7 +38,7 @@ Repository = 'https://github.com/Newscatcher/newscatcher-catchall-python'

[tool.poetry.dependencies]
python = "^3.10"
aiohttp = { version = ">=3.14.0,<4", optional = true, python = ">=3.10"}
aiohttp = { version = ">=3.14.1,<4", optional = true, python = ">=3.10"}
httpx = ">=0.21.2"
httpx-aiohttp = { version = "0.1.8", optional = true, python = ">=3.10"}
pydantic = ">= 1.9.2"
Expand All @@ -58,6 +58,7 @@ ruff = "==0.11.5"
[tool.pytest.ini_options]
testpaths = [ "tests" ]
asyncio_mode = "auto"
norecursedirs = [ "src" ]
markers = [
"aiohttp: tests that require httpx_aiohttp to be installed",
]
Expand Down
154 changes: 154 additions & 0 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,79 @@ client.jobs.get_job_results(
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.jobs.<a href="src/newscatcher_catchall/jobs/client.py">get_job_results_csv</a>(...) -> str</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Returns a completed job's result records as a CSV download. One row per record, with enrichment fields as columns, citations as a JSON column, and connected entities split into `event_associated_entities` and `mention_entities` JSON columns.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```python
from newscatcher_catchall import CatchAllApi
from newscatcher_catchall.environment import CatchAllApiEnvironment

client = CatchAllApi(
api_key="<value>",
environment=CatchAllApiEnvironment.DEFAULT,
)

client.jobs.get_job_results_csv(
job_id="job_id",
)

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**job_id:** `str` — Unique job identifier returned from [`POST /catchAll/submit`](https://www.newscatcherapi.com/docs/web-search-api/api-reference/jobs/create-job).

</dd>
</dl>

<dl>
<dd>

**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.

</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>
Expand Down Expand Up @@ -1134,6 +1207,79 @@ client.monitors.pull_monitor_results(
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.monitors.<a href="src/newscatcher_catchall/monitors/client.py">pull_monitor_results_csv</a>(...) -> str</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Returns the most recent run's records as a CSV download. One row per record, with enrichment fields as columns, citations as a JSON column, and connected entities split into `event_associated_entities` and `mention_entities` JSON columns.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```python
from newscatcher_catchall import CatchAllApi
from newscatcher_catchall.environment import CatchAllApiEnvironment

client = CatchAllApi(
api_key="<value>",
environment=CatchAllApiEnvironment.DEFAULT,
)

client.monitors.pull_monitor_results_csv(
monitor_id="monitor_id",
)

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**monitor_id:** `str` — Monitor identifier.

</dd>
</dl>

<dl>
<dd>

**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.

</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>
Expand Down Expand Up @@ -3312,6 +3458,14 @@ client.entities.update_entity(
<dl>
<dd>

**external_entity_id:** `typing.Optional[str]` — Updated external identifier for this entity.

</dd>
</dl>

<dl>
<dd>

**additional_attributes:** `typing.Optional[AdditionalAttributes]`

</dd>
Expand Down
3 changes: 3 additions & 0 deletions src/newscatcher_catchall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
CompanyEnrichmentOutput,
CompanyEnrichmentOutputMetadata,
CompanyEnrichmentOutputMetadataDomainUrlConfidence,
ConnectedDataset,
ConnectedEntity,
Context,
ContinueResponseDto,
Expand Down Expand Up @@ -173,6 +174,7 @@
"CompanyEnrichmentOutput": ".types",
"CompanyEnrichmentOutputMetadata": ".types",
"CompanyEnrichmentOutputMetadataDomainUrlConfidence": ".types",
"ConnectedDataset": ".types",
"ConnectedEntity": ".types",
"Context": ".types",
"ContinueResponseDto": ".types",
Expand Down Expand Up @@ -353,6 +355,7 @@ def __dir__():
"CompanyEnrichmentOutput",
"CompanyEnrichmentOutputMetadata",
"CompanyEnrichmentOutputMetadataDomainUrlConfidence",
"ConnectedDataset",
"ConnectedEntity",
"Context",
"ContinueResponseDto",
Expand Down
4 changes: 2 additions & 2 deletions src/newscatcher_catchall/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ def get_headers(self) -> typing.Dict[str, str]:
import platform

headers: typing.Dict[str, str] = {
"User-Agent": "newscatcher-catchall-sdk/3.0.1",
"User-Agent": "newscatcher-catchall-sdk/0.0.0.dev0",
"X-Fern-Language": "Python",
"X-Fern-Runtime": f"python/{platform.python_version()}",
"X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}",
"X-Fern-SDK-Name": "newscatcher-catchall-sdk",
"X-Fern-SDK-Version": "3.0.1",
"X-Fern-SDK-Version": "0.0.0.dev0",
**(self.get_custom_headers() or {}),
}
headers["x-api-key"] = self.api_key
Expand Down
22 changes: 22 additions & 0 deletions src/newscatcher_catchall/core/http_sse/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from ._exceptions import SSEError
from ._models import ServerSentEvent

MAX_LINE_SIZE: int = 1_048_576 # 1 MiB


class EventSource:
def __init__(self, response: httpx.Response) -> None:
Expand Down Expand Up @@ -75,10 +77,20 @@ def iter_sse(self) -> Iterator[ServerSentEvent]:
if sse is not None:
yield sse

if len(buf) > MAX_LINE_SIZE:
raise SSEError(
f"SSE line exceeded maximum size of {MAX_LINE_SIZE} characters without encountering a newline"
)

# Flush any remaining bytes from the incremental decoder
buf += text_decoder.decode(b"", final=True)
buf = buf.replace("\r\n", "\n").replace("\r", "\n")

if len(buf) > MAX_LINE_SIZE:
raise SSEError(
f"SSE line exceeded maximum size of {MAX_LINE_SIZE} characters without encountering a newline"
)

while "\n" in buf:
line, buf = buf.split("\n", 1)
sse = decoder.decode(line)
Expand Down Expand Up @@ -107,10 +119,20 @@ async def aiter_sse(self) -> AsyncGenerator[ServerSentEvent, None]:
if sse is not None:
yield sse

if len(buf) > MAX_LINE_SIZE:
raise SSEError(
f"SSE line exceeded maximum size of {MAX_LINE_SIZE} characters without encountering a newline"
)

# Flush any remaining bytes from the incremental decoder
buf += text_decoder.decode(b"", final=True)
buf = buf.replace("\r\n", "\n").replace("\r", "\n")

if len(buf) > MAX_LINE_SIZE:
raise SSEError(
f"SSE line exceeded maximum size of {MAX_LINE_SIZE} characters without encountering a newline"
)

while "\n" in buf:
line, buf = buf.split("\n", 1)
sse = decoder.decode(line)
Expand Down
Loading
Loading