scrapingrabbit-haystack 0.1.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.
- scrapingrabbit_haystack-0.1.0/.github/workflows/ci.yml +27 -0
- scrapingrabbit_haystack-0.1.0/.github/workflows/publish.yml +45 -0
- scrapingrabbit_haystack-0.1.0/.gitignore +4 -0
- scrapingrabbit_haystack-0.1.0/LICENSE +21 -0
- scrapingrabbit_haystack-0.1.0/PKG-INFO +101 -0
- scrapingrabbit_haystack-0.1.0/README.md +74 -0
- scrapingrabbit_haystack-0.1.0/pyproject.toml +38 -0
- scrapingrabbit_haystack-0.1.0/src/haystack_integrations/components/fetchers/scrapingrabbit/__init__.py +3 -0
- scrapingrabbit_haystack-0.1.0/src/haystack_integrations/components/fetchers/scrapingrabbit/fetcher.py +66 -0
- scrapingrabbit_haystack-0.1.0/src/haystack_integrations/tools/scrapingrabbit/__init__.py +3 -0
- scrapingrabbit_haystack-0.1.0/src/haystack_integrations/tools/scrapingrabbit/toolset.py +108 -0
- scrapingrabbit_haystack-0.1.0/tests/test_haystack.py +214 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
include:
|
|
17
|
+
- python: "3.10"
|
|
18
|
+
haystack: "haystack-ai==2.14.*" # oldest supported
|
|
19
|
+
- python: "3.13"
|
|
20
|
+
haystack: "haystack-ai" # newest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python }}
|
|
26
|
+
- run: python -m pip install . "${{ matrix.haystack }}"
|
|
27
|
+
- run: python -m unittest discover -s tests
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Push a version tag (for example v0.1.0 after bumping `version` in pyproject.toml) and this publishes that commit.
|
|
4
|
+
# No PyPI token is stored: PyPI trusts this workflow through "trusted publishing" (OIDC), set once on pypi.org
|
|
5
|
+
# (repo scrapingrabbit/scrapingrabbit-haystack, workflow publish.yml, environment pypi).
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags: ["v*"]
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.12"
|
|
21
|
+
- name: Tag must match pyproject.toml
|
|
22
|
+
run: |
|
|
23
|
+
PKG="v$(python -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")"
|
|
24
|
+
if [ "$GITHUB_REF_NAME" != "$PKG" ]; then echo "Tag $GITHUB_REF_NAME does not match pyproject.toml $PKG"; exit 1; fi
|
|
25
|
+
- run: python -m pip install build twine .
|
|
26
|
+
- run: python -m unittest discover -s tests
|
|
27
|
+
- run: python -m build
|
|
28
|
+
- run: python -m twine check --strict dist/*
|
|
29
|
+
- uses: actions/upload-artifact@v4
|
|
30
|
+
with:
|
|
31
|
+
name: dist
|
|
32
|
+
path: dist/
|
|
33
|
+
|
|
34
|
+
publish:
|
|
35
|
+
needs: build
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
environment: pypi
|
|
38
|
+
permissions:
|
|
39
|
+
id-token: write
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/download-artifact@v4
|
|
42
|
+
with:
|
|
43
|
+
name: dist
|
|
44
|
+
path: dist/
|
|
45
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ScrapingRabbit
|
|
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,101 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: scrapingrabbit-haystack
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: ScrapingRabbit for Haystack: one Tool per endpoint for Agents (video transcripts, social profiles, Amazon and Walmart products, Google results, SEO data) and a YouTube transcript fetcher that returns Documents.
|
|
5
|
+
Project-URL: Homepage, https://scrapingrabbit.com
|
|
6
|
+
Project-URL: Documentation, https://github.com/scrapingrabbit/scrapingrabbit-haystack#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/scrapingrabbit/scrapingrabbit-haystack
|
|
8
|
+
Project-URL: Issues, https://github.com/scrapingrabbit/scrapingrabbit-haystack/issues
|
|
9
|
+
Project-URL: API reference, https://scrapingrabbit.com/docs
|
|
10
|
+
Author: ScrapingRabbit
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: agents,amazon,deepset,haystack,haystack-ai,instagram,llm,rag,scrapingrabbit,serp,tiktok,tools,toolset,web-data,youtube-transcript
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: haystack-ai>=2.14.0
|
|
25
|
+
Requires-Dist: scrapingrabbit<1.0.0,>=0.2.0
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# scrapingrabbit-haystack
|
|
29
|
+
|
|
30
|
+
[ScrapingRabbit](https://scrapingrabbit.com) for [Haystack](https://haystack.deepset.ai):
|
|
31
|
+
|
|
32
|
+
- `ScrapingRabbitToolset`: one Tool per API endpoint for Haystack Agents and chat generators. That covers YouTube, TikTok and X transcripts, YouTube comments and channels, Instagram, TikTok and Snapchat profiles, Amazon and Walmart products, Google News, Maps, Trends and autocomplete, App Store, SEO data (domain authority, traffic, age) and email verification.
|
|
33
|
+
- `ScrapingRabbitTranscriptFetcher`: a pipeline component that turns YouTube links into Documents for indexing and RAG.
|
|
34
|
+
|
|
35
|
+
Both are built on the [`scrapingrabbit`](https://pypi.org/project/scrapingrabbit/) SDK, and the tools come from its endpoint list, so they match the live API.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install scrapingrabbit-haystack
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Get an API key at [scrapingrabbit.com/login](https://scrapingrabbit.com/login) (100 free credits, no card) and set `SCRAPINGRABBIT_API_KEY`.
|
|
44
|
+
|
|
45
|
+
## Agent with tools
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from haystack.components.agents import Agent
|
|
49
|
+
from haystack.components.generators.chat import OpenAIChatGenerator
|
|
50
|
+
from haystack.dataclasses import ChatMessage
|
|
51
|
+
from haystack_integrations.tools.scrapingrabbit import ScrapingRabbitToolset
|
|
52
|
+
|
|
53
|
+
agent = Agent(
|
|
54
|
+
chat_generator=OpenAIChatGenerator(model="gpt-5-mini"),
|
|
55
|
+
tools=ScrapingRabbitToolset(include=["youtube_transcript", "youtube_comment_extractor"]),
|
|
56
|
+
)
|
|
57
|
+
result = agent.run(messages=[ChatMessage.from_user(
|
|
58
|
+
"Summarise https://www.youtube.com/watch?v=dQw4w9WgXcQ and what commenters think of it."
|
|
59
|
+
)])
|
|
60
|
+
print(result["messages"][-1].text)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Without `include` you get all 31 tools; a short list helps the model choose and saves prompt tokens.
|
|
64
|
+
|
|
65
|
+
| Option | Default | |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| `api_key` | `Secret.from_env_var("SCRAPINGRABBIT_API_KEY")` | Read on the first tool call. Saved pipelines store the variable name, never the key. |
|
|
68
|
+
| `include` | all | Tool names, for example `["tiktok_profile_viewer"]` (the SDK's `scrapingrabbit.ENDPOINTS`). |
|
|
69
|
+
| `max_chars` | `60000` | Longer results are cut, with a note that the last record is incomplete. Minimum 1000. |
|
|
70
|
+
|
|
71
|
+
When the API refuses a call (bad link, no captions, rate limit), the tool raises `CODE: message (failed calls are not charged)`. A Haystack Agent passes that to the model as a tool error and keeps going. A client-side timeout is reported without the "not charged" note, because the API may still have finished the call.
|
|
72
|
+
|
|
73
|
+
## Transcripts as Documents
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from haystack_integrations.components.fetchers.scrapingrabbit import ScrapingRabbitTranscriptFetcher
|
|
77
|
+
|
|
78
|
+
fetcher = ScrapingRabbitTranscriptFetcher()
|
|
79
|
+
out = fetcher.run(urls=["https://www.youtube.com/watch?v=dQw4w9WgXcQ", "https://youtu.be/jNQXAC9IVRw"])
|
|
80
|
+
out["documents"] # one Document per video: transcript text, meta url, video_id, language, is_auto_generated
|
|
81
|
+
out["failed"] # videos that returned no transcript, with code and message (not charged)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Each video costs 1 credit when it returns a transcript. Pass `raise_on_failure=True` to stop at the first failure instead of skipping it. It works in any pipeline, for example in front of a `DocumentSplitter` and a document writer.
|
|
85
|
+
|
|
86
|
+
## Also available
|
|
87
|
+
|
|
88
|
+
[Python client](https://github.com/scrapingrabbit/scrapingrabbit-python) · [LangChain](https://github.com/scrapingrabbit/langchain-scrapingrabbit) · [LlamaIndex](https://github.com/scrapingrabbit/llama-index-tools-scrapingrabbit) · [CrewAI](https://github.com/scrapingrabbit/crewai-scrapingrabbit) · [Vercel AI SDK](https://github.com/scrapingrabbit/ai-sdk-scrapingrabbit) · [MCP server](https://github.com/scrapingrabbit/scrapingrabbit-mcp) · [API docs](https://scrapingrabbit.com/docs)
|
|
89
|
+
|
|
90
|
+
## Develop
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pip install -e .
|
|
94
|
+
python -m unittest discover -s tests # runs everything against a local fake API, including a real Haystack Agent loop
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Release: bump `version` in pyproject.toml and push a matching tag (`v0.1.0`). The publish workflow uses PyPI trusted publishing.
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
MIT
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# scrapingrabbit-haystack
|
|
2
|
+
|
|
3
|
+
[ScrapingRabbit](https://scrapingrabbit.com) for [Haystack](https://haystack.deepset.ai):
|
|
4
|
+
|
|
5
|
+
- `ScrapingRabbitToolset`: one Tool per API endpoint for Haystack Agents and chat generators. That covers YouTube, TikTok and X transcripts, YouTube comments and channels, Instagram, TikTok and Snapchat profiles, Amazon and Walmart products, Google News, Maps, Trends and autocomplete, App Store, SEO data (domain authority, traffic, age) and email verification.
|
|
6
|
+
- `ScrapingRabbitTranscriptFetcher`: a pipeline component that turns YouTube links into Documents for indexing and RAG.
|
|
7
|
+
|
|
8
|
+
Both are built on the [`scrapingrabbit`](https://pypi.org/project/scrapingrabbit/) SDK, and the tools come from its endpoint list, so they match the live API.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install scrapingrabbit-haystack
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Get an API key at [scrapingrabbit.com/login](https://scrapingrabbit.com/login) (100 free credits, no card) and set `SCRAPINGRABBIT_API_KEY`.
|
|
17
|
+
|
|
18
|
+
## Agent with tools
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from haystack.components.agents import Agent
|
|
22
|
+
from haystack.components.generators.chat import OpenAIChatGenerator
|
|
23
|
+
from haystack.dataclasses import ChatMessage
|
|
24
|
+
from haystack_integrations.tools.scrapingrabbit import ScrapingRabbitToolset
|
|
25
|
+
|
|
26
|
+
agent = Agent(
|
|
27
|
+
chat_generator=OpenAIChatGenerator(model="gpt-5-mini"),
|
|
28
|
+
tools=ScrapingRabbitToolset(include=["youtube_transcript", "youtube_comment_extractor"]),
|
|
29
|
+
)
|
|
30
|
+
result = agent.run(messages=[ChatMessage.from_user(
|
|
31
|
+
"Summarise https://www.youtube.com/watch?v=dQw4w9WgXcQ and what commenters think of it."
|
|
32
|
+
)])
|
|
33
|
+
print(result["messages"][-1].text)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Without `include` you get all 31 tools; a short list helps the model choose and saves prompt tokens.
|
|
37
|
+
|
|
38
|
+
| Option | Default | |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| `api_key` | `Secret.from_env_var("SCRAPINGRABBIT_API_KEY")` | Read on the first tool call. Saved pipelines store the variable name, never the key. |
|
|
41
|
+
| `include` | all | Tool names, for example `["tiktok_profile_viewer"]` (the SDK's `scrapingrabbit.ENDPOINTS`). |
|
|
42
|
+
| `max_chars` | `60000` | Longer results are cut, with a note that the last record is incomplete. Minimum 1000. |
|
|
43
|
+
|
|
44
|
+
When the API refuses a call (bad link, no captions, rate limit), the tool raises `CODE: message (failed calls are not charged)`. A Haystack Agent passes that to the model as a tool error and keeps going. A client-side timeout is reported without the "not charged" note, because the API may still have finished the call.
|
|
45
|
+
|
|
46
|
+
## Transcripts as Documents
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from haystack_integrations.components.fetchers.scrapingrabbit import ScrapingRabbitTranscriptFetcher
|
|
50
|
+
|
|
51
|
+
fetcher = ScrapingRabbitTranscriptFetcher()
|
|
52
|
+
out = fetcher.run(urls=["https://www.youtube.com/watch?v=dQw4w9WgXcQ", "https://youtu.be/jNQXAC9IVRw"])
|
|
53
|
+
out["documents"] # one Document per video: transcript text, meta url, video_id, language, is_auto_generated
|
|
54
|
+
out["failed"] # videos that returned no transcript, with code and message (not charged)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Each video costs 1 credit when it returns a transcript. Pass `raise_on_failure=True` to stop at the first failure instead of skipping it. It works in any pipeline, for example in front of a `DocumentSplitter` and a document writer.
|
|
58
|
+
|
|
59
|
+
## Also available
|
|
60
|
+
|
|
61
|
+
[Python client](https://github.com/scrapingrabbit/scrapingrabbit-python) · [LangChain](https://github.com/scrapingrabbit/langchain-scrapingrabbit) · [LlamaIndex](https://github.com/scrapingrabbit/llama-index-tools-scrapingrabbit) · [CrewAI](https://github.com/scrapingrabbit/crewai-scrapingrabbit) · [Vercel AI SDK](https://github.com/scrapingrabbit/ai-sdk-scrapingrabbit) · [MCP server](https://github.com/scrapingrabbit/scrapingrabbit-mcp) · [API docs](https://scrapingrabbit.com/docs)
|
|
62
|
+
|
|
63
|
+
## Develop
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install -e .
|
|
67
|
+
python -m unittest discover -s tests # runs everything against a local fake API, including a real Haystack Agent loop
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Release: bump `version` in pyproject.toml and push a matching tag (`v0.1.0`). The publish workflow uses PyPI trusted publishing.
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "scrapingrabbit-haystack"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "ScrapingRabbit for Haystack: one Tool per endpoint for Agents (video transcripts, social profiles, Amazon and Walmart products, Google results, SEO data) and a YouTube transcript fetcher that returns Documents."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "ScrapingRabbit" }]
|
|
13
|
+
keywords = ["haystack", "haystack-ai", "deepset", "agents", "tools", "toolset", "rag", "llm", "web-data", "youtube-transcript", "tiktok", "instagram", "amazon", "serp", "scrapingrabbit"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"haystack-ai>=2.14.0",
|
|
27
|
+
"scrapingrabbit>=0.2.0,<1.0.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://scrapingrabbit.com"
|
|
32
|
+
Documentation = "https://github.com/scrapingrabbit/scrapingrabbit-haystack#readme"
|
|
33
|
+
Repository = "https://github.com/scrapingrabbit/scrapingrabbit-haystack"
|
|
34
|
+
Issues = "https://github.com/scrapingrabbit/scrapingrabbit-haystack/issues"
|
|
35
|
+
"API reference" = "https://scrapingrabbit.com/docs"
|
|
36
|
+
|
|
37
|
+
[tool.hatch.build.targets.wheel]
|
|
38
|
+
packages = ["src/haystack_integrations"]
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""YouTube transcripts as Haystack Documents, for indexing and RAG pipelines."""
|
|
2
|
+
import logging
|
|
3
|
+
from typing import Any, Dict, List, Optional
|
|
4
|
+
|
|
5
|
+
from haystack import Document, component, default_from_dict, default_to_dict
|
|
6
|
+
from haystack.utils import Secret, deserialize_secrets_inplace
|
|
7
|
+
from scrapingrabbit import ScrapingRabbit, ScrapingRabbitError
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@component
|
|
13
|
+
class ScrapingRabbitTranscriptFetcher:
|
|
14
|
+
"""Fetches YouTube transcripts and returns one Document per video.
|
|
15
|
+
|
|
16
|
+
Each video costs 1 credit when it returns a transcript; failures are free. By default a video that fails (no
|
|
17
|
+
captions, private, bad link) is skipped with a warning and listed in `failed`, so one bad link doesn't stop a
|
|
18
|
+
batch; set raise_on_failure=True to stop instead.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __init__(self, api_key: Secret = Secret.from_env_var("SCRAPINGRABBIT_API_KEY"), raise_on_failure: bool = False):
|
|
22
|
+
self.api_key = api_key
|
|
23
|
+
self.raise_on_failure = raise_on_failure
|
|
24
|
+
self._client: Optional[ScrapingRabbit] = None
|
|
25
|
+
|
|
26
|
+
def warm_up(self) -> None:
|
|
27
|
+
if self._client is None:
|
|
28
|
+
self._client = ScrapingRabbit(api_key=self.api_key.resolve_value())
|
|
29
|
+
|
|
30
|
+
@component.output_types(documents=List[Document], failed=List[Dict[str, str]])
|
|
31
|
+
def run(self, urls: List[str]) -> Dict[str, Any]:
|
|
32
|
+
"""Fetch the transcript of each YouTube link or video id in `urls`."""
|
|
33
|
+
self.warm_up()
|
|
34
|
+
assert self._client is not None
|
|
35
|
+
documents: List[Document] = []
|
|
36
|
+
failed: List[Dict[str, str]] = []
|
|
37
|
+
for url in urls:
|
|
38
|
+
try:
|
|
39
|
+
data = self._client.youtube_transcript(url=url)
|
|
40
|
+
except ScrapingRabbitError as error:
|
|
41
|
+
if self.raise_on_failure:
|
|
42
|
+
raise
|
|
43
|
+
logger.warning("Skipping %s: %s", url, error)
|
|
44
|
+
failed.append({"url": url, "code": error.code, "message": error.message})
|
|
45
|
+
continue
|
|
46
|
+
lines = data.get("transcript") or []
|
|
47
|
+
documents.append(
|
|
48
|
+
Document(
|
|
49
|
+
content=" ".join(line["text"] for line in lines if line.get("text")),
|
|
50
|
+
meta={
|
|
51
|
+
"url": url,
|
|
52
|
+
"video_id": data.get("videoId"),
|
|
53
|
+
"language": data.get("language"),
|
|
54
|
+
"is_auto_generated": data.get("isAutoGenerated"),
|
|
55
|
+
},
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
return {"documents": documents, "failed": failed}
|
|
59
|
+
|
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
61
|
+
return default_to_dict(self, api_key=self.api_key.to_dict(), raise_on_failure=self.raise_on_failure)
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_dict(cls, data: Dict[str, Any]) -> "ScrapingRabbitTranscriptFetcher":
|
|
65
|
+
deserialize_secrets_inplace(data["init_parameters"], keys=["api_key"])
|
|
66
|
+
return default_from_dict(cls, data)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"""ScrapingRabbit endpoints as Haystack Tools, built from the SDK's ENDPOINTS list."""
|
|
2
|
+
import json
|
|
3
|
+
from typing import Any, Callable, Dict, List, Optional
|
|
4
|
+
|
|
5
|
+
from haystack.core.serialization import generate_qualified_class_name
|
|
6
|
+
from haystack.tools import Tool, Toolset
|
|
7
|
+
from haystack.utils import Secret, deserialize_secrets_inplace
|
|
8
|
+
from scrapingrabbit import ENDPOINTS, ScrapingRabbit, ScrapingRabbitError
|
|
9
|
+
|
|
10
|
+
API_KEY_ENV = "SCRAPINGRABBIT_API_KEY"
|
|
11
|
+
DEFAULT_MAX_CHARS = 60_000
|
|
12
|
+
_NOT_CHARGED = " (failed calls are not charged)"
|
|
13
|
+
_BY_NAME = {endpoint["name"]: endpoint for endpoint in ENDPOINTS}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _parameters(endpoint: Dict[str, Any]) -> Dict[str, Any]:
|
|
17
|
+
return {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": {p["name"]: {"type": "string", "description": p["description"]} for p in endpoint["params"]},
|
|
20
|
+
"required": [p["name"] for p in endpoint["params"] if p["required"]],
|
|
21
|
+
"additionalProperties": False,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _fit(data: Any, max_chars: int) -> str:
|
|
26
|
+
"""The result as JSON text, cut to max_chars with a note so one call can't flood the model's context."""
|
|
27
|
+
text = json.dumps(data, ensure_ascii=False)
|
|
28
|
+
if len(text) <= max_chars:
|
|
29
|
+
return text
|
|
30
|
+
note = (
|
|
31
|
+
f"\n[Cut: showing {max_chars} of {len(text)} characters of JSON. The last record is incomplete. "
|
|
32
|
+
"Ask for less (a narrower query or fewer items) to see the rest.]"
|
|
33
|
+
)
|
|
34
|
+
return text[: max_chars - len(note)] + note
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class ScrapingRabbitToolset(Toolset):
|
|
38
|
+
"""One Tool per ScrapingRabbit endpoint (youtube_transcript, tiktok_profile_viewer, amazon_product_search, ...).
|
|
39
|
+
|
|
40
|
+
Pass it to a Haystack Agent or chat generator as `tools`. The API key is read when a tool is first called, so
|
|
41
|
+
building the toolset never fails for a missing key. Refusals raise `CODE: message (failed calls are not
|
|
42
|
+
charged)`; an Agent hands that to the model as a tool error.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
def __init__(
|
|
46
|
+
self,
|
|
47
|
+
api_key: Secret = Secret.from_env_var(API_KEY_ENV),
|
|
48
|
+
include: Optional[List[str]] = None,
|
|
49
|
+
max_chars: int = DEFAULT_MAX_CHARS,
|
|
50
|
+
) -> None:
|
|
51
|
+
unknown = [name for name in include or [] if name not in _BY_NAME]
|
|
52
|
+
if unknown:
|
|
53
|
+
raise ValueError(f"Unknown tool name(s): {', '.join(unknown)}")
|
|
54
|
+
if not isinstance(max_chars, int) or max_chars < 1000:
|
|
55
|
+
raise ValueError("max_chars must be an integer of at least 1000")
|
|
56
|
+
self.api_key = api_key
|
|
57
|
+
self.include = list(include) if include is not None else None
|
|
58
|
+
self.max_chars = max_chars
|
|
59
|
+
self._client: Optional[ScrapingRabbit] = None
|
|
60
|
+
wanted = self.include if self.include is not None else list(_BY_NAME)
|
|
61
|
+
super().__init__(tools=[self._tool(_BY_NAME[name]) for name in wanted])
|
|
62
|
+
|
|
63
|
+
def _get_client(self) -> ScrapingRabbit:
|
|
64
|
+
if self._client is None:
|
|
65
|
+
self._client = ScrapingRabbit(api_key=self.api_key.resolve_value())
|
|
66
|
+
return self._client
|
|
67
|
+
|
|
68
|
+
def _tool(self, endpoint: Dict[str, Any]) -> Tool:
|
|
69
|
+
return Tool(
|
|
70
|
+
name=endpoint["name"],
|
|
71
|
+
# The API's description already says what a call costs.
|
|
72
|
+
description=endpoint["description"] or endpoint["summary"],
|
|
73
|
+
parameters=_parameters(endpoint),
|
|
74
|
+
function=self._runner(endpoint),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
def _runner(self, endpoint: Dict[str, Any]) -> Callable[..., str]:
|
|
78
|
+
known = {p["name"] for p in endpoint["params"]}
|
|
79
|
+
|
|
80
|
+
def run(**kwargs: Any) -> str:
|
|
81
|
+
unknown = sorted(set(kwargs) - known)
|
|
82
|
+
if unknown:
|
|
83
|
+
raise ValueError(f"Unknown argument(s): {', '.join(unknown)}. Allowed: {', '.join(sorted(known)) or 'none'}.")
|
|
84
|
+
# Every API parameter is a string; models sometimes send ids as numbers.
|
|
85
|
+
params = {k: str(v) for k, v in kwargs.items() if v is not None}
|
|
86
|
+
try:
|
|
87
|
+
data = getattr(self._get_client(), endpoint["name"])(**params)
|
|
88
|
+
except ScrapingRabbitError as error:
|
|
89
|
+
# Only a refusal from the API (it has an HTTP status) is known to be free; a client-side timeout may still be charged.
|
|
90
|
+
suffix = _NOT_CHARGED if error.status is not None else ""
|
|
91
|
+
raise RuntimeError(f"{error}{suffix}") from error
|
|
92
|
+
return _fit(data, self.max_chars)
|
|
93
|
+
|
|
94
|
+
run.__name__ = endpoint["name"]
|
|
95
|
+
return run
|
|
96
|
+
|
|
97
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
98
|
+
# Serialize the settings, not the tools: they are rebuilt from the SDK's endpoint list on load.
|
|
99
|
+
return {
|
|
100
|
+
"type": generate_qualified_class_name(type(self)),
|
|
101
|
+
"data": {"api_key": self.api_key.to_dict(), "include": self.include, "max_chars": self.max_chars},
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@classmethod
|
|
105
|
+
def from_dict(cls, data: Dict[str, Any]) -> "ScrapingRabbitToolset":
|
|
106
|
+
init = dict(data["data"])
|
|
107
|
+
deserialize_secrets_inplace(init, keys=["api_key"])
|
|
108
|
+
return cls(**init)
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"""Runs the toolset and fetcher through the real scrapingrabbit client against a local HTTP server that plays the API."""
|
|
2
|
+
import json
|
|
3
|
+
import os
|
|
4
|
+
import threading
|
|
5
|
+
import time
|
|
6
|
+
import unittest
|
|
7
|
+
from http.server import BaseHTTPRequestHandler, HTTPServer
|
|
8
|
+
from typing import Any, Dict, List
|
|
9
|
+
from urllib.parse import parse_qs, urlparse
|
|
10
|
+
|
|
11
|
+
from haystack import Pipeline, component
|
|
12
|
+
from haystack.components.agents import Agent
|
|
13
|
+
from haystack.dataclasses import ChatMessage, ToolCall
|
|
14
|
+
from haystack.utils import Secret
|
|
15
|
+
from scrapingrabbit import ENDPOINTS, ScrapingRabbit
|
|
16
|
+
|
|
17
|
+
from haystack_integrations.components.fetchers.scrapingrabbit import ScrapingRabbitTranscriptFetcher
|
|
18
|
+
from haystack_integrations.tools.scrapingrabbit import ScrapingRabbitToolset
|
|
19
|
+
|
|
20
|
+
REQUESTS: List[Dict[str, Any]] = []
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def tool(toolset, name):
|
|
24
|
+
return next(t for t in toolset if t.name == name)
|
|
25
|
+
|
|
26
|
+
TRANSCRIPT = {"videoId": "abc", "language": "en", "isAutoGenerated": False, "transcript": [{"text": "hello"}, {"text": "world"}]}
|
|
27
|
+
HOLD = {"seconds": 0.0}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class Handler(BaseHTTPRequestHandler):
|
|
31
|
+
def do_GET(self):
|
|
32
|
+
url = urlparse(self.path)
|
|
33
|
+
query = parse_qs(url.query)
|
|
34
|
+
REQUESTS.append({"path": url.path, "query": query, "key": self.headers.get("x-api-key")})
|
|
35
|
+
time.sleep(HOLD["seconds"])
|
|
36
|
+
if url.path == "/v1/youtube/transcript" and query.get("url") == ["nocaptions"]:
|
|
37
|
+
status, body = 404, {"success": False, "code": "UPSTREAM_NOT_FOUND", "message": "This video has no captions"}
|
|
38
|
+
elif url.path == "/v1/youtube/transcript":
|
|
39
|
+
status, body = 200, {"success": True, "data": TRANSCRIPT}
|
|
40
|
+
elif url.path == "/v1/account/credits":
|
|
41
|
+
status, body = 200, {"success": True, "data": {"credits": 7}}
|
|
42
|
+
else:
|
|
43
|
+
status, body = 200, {"success": True, "data": {"path": url.path, "items": [{"text": 'he said "hi"'}] * 300}}
|
|
44
|
+
payload = json.dumps(body).encode()
|
|
45
|
+
try:
|
|
46
|
+
self.send_response(status)
|
|
47
|
+
self.send_header("content-type", "application/json")
|
|
48
|
+
self.send_header("content-length", str(len(payload)))
|
|
49
|
+
self.end_headers()
|
|
50
|
+
self.wfile.write(payload)
|
|
51
|
+
except (BrokenPipeError, ConnectionResetError):
|
|
52
|
+
pass
|
|
53
|
+
|
|
54
|
+
def log_message(self, *args):
|
|
55
|
+
pass
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@component
|
|
59
|
+
class ScriptedChatGenerator:
|
|
60
|
+
"""Plays a model: first asks for one tool call, then answers with the tool result it was given."""
|
|
61
|
+
|
|
62
|
+
def __init__(self, tool_name: str, arguments: Dict[str, Any]):
|
|
63
|
+
self.tool_name = tool_name
|
|
64
|
+
self.arguments = arguments
|
|
65
|
+
self.seen: List[ChatMessage] = []
|
|
66
|
+
|
|
67
|
+
@component.output_types(replies=List[ChatMessage])
|
|
68
|
+
def run(self, messages: List[ChatMessage], tools: Any = None, **kwargs: Any) -> Dict[str, Any]:
|
|
69
|
+
self.seen = list(messages)
|
|
70
|
+
results = [m for m in messages if m.tool_call_result is not None]
|
|
71
|
+
if not results:
|
|
72
|
+
return {"replies": [ChatMessage.from_assistant(tool_calls=[ToolCall(tool_name=self.tool_name, arguments=self.arguments)])]}
|
|
73
|
+
result = results[-1].tool_call_result
|
|
74
|
+
return {"replies": [ChatMessage.from_assistant(f"error={result.error} result={result.result}")]}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class HaystackTests(unittest.TestCase):
|
|
78
|
+
@classmethod
|
|
79
|
+
def setUpClass(cls):
|
|
80
|
+
cls.server = HTTPServer(("127.0.0.1", 0), Handler)
|
|
81
|
+
threading.Thread(target=cls.server.serve_forever, daemon=True).start()
|
|
82
|
+
cls.base_url = f"http://127.0.0.1:{cls.server.server_port}/v1"
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def tearDownClass(cls):
|
|
86
|
+
cls.server.shutdown()
|
|
87
|
+
|
|
88
|
+
def setUp(self):
|
|
89
|
+
REQUESTS.clear()
|
|
90
|
+
HOLD["seconds"] = 0.0
|
|
91
|
+
|
|
92
|
+
def client(self, **kwargs):
|
|
93
|
+
return ScrapingRabbit("sr_live_testkey", base_url=self.base_url, max_retries=0, **kwargs)
|
|
94
|
+
|
|
95
|
+
def toolset(self, **kwargs):
|
|
96
|
+
toolset = ScrapingRabbitToolset(api_key=Secret.from_token("sr_live_testkey"), **kwargs)
|
|
97
|
+
toolset._client = self.client()
|
|
98
|
+
return toolset
|
|
99
|
+
|
|
100
|
+
def test_one_tool_per_endpoint_with_schema(self):
|
|
101
|
+
toolset = self.toolset()
|
|
102
|
+
self.assertEqual([t.name for t in toolset], [e["name"] for e in ENDPOINTS])
|
|
103
|
+
transcript = next(t for t in toolset if t.name == "youtube_transcript")
|
|
104
|
+
self.assertEqual(transcript.parameters["required"], ["url"])
|
|
105
|
+
self.assertFalse(transcript.parameters["additionalProperties"])
|
|
106
|
+
self.assertLessEqual(len([s for s in transcript.description.split(".") if "Costs" in s]), 1)
|
|
107
|
+
|
|
108
|
+
def test_tool_calls_the_endpoint_and_returns_json(self):
|
|
109
|
+
toolset = self.toolset(include=["youtube_transcript"])
|
|
110
|
+
result = tool(toolset, "youtube_transcript").invoke(url="https://youtu.be/abc")
|
|
111
|
+
self.assertEqual(json.loads(result), TRANSCRIPT)
|
|
112
|
+
self.assertEqual(REQUESTS[0]["path"], "/v1/youtube/transcript")
|
|
113
|
+
self.assertEqual(REQUESTS[0]["query"]["url"], ["https://youtu.be/abc"])
|
|
114
|
+
|
|
115
|
+
def test_refusal_raises_with_code_and_not_charged_note(self):
|
|
116
|
+
toolset = self.toolset(include=["youtube_transcript"])
|
|
117
|
+
with self.assertRaises(Exception) as caught:
|
|
118
|
+
tool(toolset, "youtube_transcript").invoke(url="nocaptions")
|
|
119
|
+
self.assertIn("UPSTREAM_NOT_FOUND: This video has no captions (failed calls are not charged)", str(caught.exception))
|
|
120
|
+
|
|
121
|
+
def test_client_timeout_does_not_claim_the_call_was_free(self):
|
|
122
|
+
toolset = self.toolset(include=["account_credits"])
|
|
123
|
+
toolset._client = self.client(timeout=0.2)
|
|
124
|
+
HOLD["seconds"] = 1.0
|
|
125
|
+
with self.assertRaises(Exception) as caught:
|
|
126
|
+
tool(toolset, "account_credits").invoke()
|
|
127
|
+
self.assertNotIn("not charged", str(caught.exception))
|
|
128
|
+
|
|
129
|
+
def test_unknown_arguments_are_rejected_without_a_call(self):
|
|
130
|
+
toolset = self.toolset(include=["youtube_transcript"])
|
|
131
|
+
with self.assertRaises(Exception) as caught:
|
|
132
|
+
tool(toolset, "youtube_transcript").invoke(url="x", nope="1")
|
|
133
|
+
self.assertIn("Unknown argument(s): nope", str(caught.exception))
|
|
134
|
+
self.assertEqual(REQUESTS, [])
|
|
135
|
+
|
|
136
|
+
def test_numbers_are_sent_as_strings(self):
|
|
137
|
+
toolset = self.toolset(include=["amazon_best_sellers_viewer"])
|
|
138
|
+
tool(toolset, "amazon_best_sellers_viewer").invoke(category_id=172282)
|
|
139
|
+
self.assertEqual(REQUESTS[0]["query"]["category_id"], ["172282"])
|
|
140
|
+
|
|
141
|
+
def test_long_results_are_cut_to_max_chars_with_a_note(self):
|
|
142
|
+
toolset = self.toolset(include=["amazon_best_sellers_viewer"], max_chars=1000)
|
|
143
|
+
result = tool(toolset, "amazon_best_sellers_viewer").invoke(category_id="books")
|
|
144
|
+
self.assertLessEqual(len(result), 1000)
|
|
145
|
+
self.assertIn("[Cut: showing 1000 of", result)
|
|
146
|
+
self.assertIn('he said \\"hi\\"', result) # JSON escaping applied once
|
|
147
|
+
|
|
148
|
+
def test_bad_settings_are_rejected(self):
|
|
149
|
+
with self.assertRaises(ValueError):
|
|
150
|
+
ScrapingRabbitToolset(include=["nope"])
|
|
151
|
+
with self.assertRaises(ValueError):
|
|
152
|
+
ScrapingRabbitToolset(max_chars=10)
|
|
153
|
+
|
|
154
|
+
def test_building_without_a_key_works_and_the_call_explains(self):
|
|
155
|
+
saved = os.environ.pop("SCRAPINGRABBIT_API_KEY", None)
|
|
156
|
+
try:
|
|
157
|
+
toolset = ScrapingRabbitToolset(include=["account_credits"])
|
|
158
|
+
with self.assertRaises(Exception) as caught:
|
|
159
|
+
tool(toolset, "account_credits").invoke()
|
|
160
|
+
self.assertIn("SCRAPINGRABBIT_API_KEY", str(caught.exception))
|
|
161
|
+
finally:
|
|
162
|
+
if saved is not None:
|
|
163
|
+
os.environ["SCRAPINGRABBIT_API_KEY"] = saved
|
|
164
|
+
|
|
165
|
+
def test_toolset_round_trips_through_to_dict_without_the_key(self):
|
|
166
|
+
toolset = ScrapingRabbitToolset(include=["youtube_transcript", "account_credits"], max_chars=5000)
|
|
167
|
+
data = toolset.to_dict()
|
|
168
|
+
self.assertNotIn("sr_live", json.dumps(data))
|
|
169
|
+
restored = ScrapingRabbitToolset.from_dict(data)
|
|
170
|
+
self.assertEqual([t.name for t in restored], ["youtube_transcript", "account_credits"])
|
|
171
|
+
self.assertEqual(restored.max_chars, 5000)
|
|
172
|
+
|
|
173
|
+
def test_agent_runs_a_tool_and_feeds_the_result_back(self):
|
|
174
|
+
generator = ScriptedChatGenerator("account_credits", {})
|
|
175
|
+
agent = Agent(chat_generator=generator, tools=self.toolset(include=["account_credits"]))
|
|
176
|
+
if hasattr(agent, "warm_up"):
|
|
177
|
+
agent.warm_up()
|
|
178
|
+
result = agent.run(messages=[ChatMessage.from_user("How many credits do I have?")])
|
|
179
|
+
self.assertIn('{"credits": 7}', result["messages"][-1].text)
|
|
180
|
+
self.assertIn("error=False", result["messages"][-1].text)
|
|
181
|
+
|
|
182
|
+
def test_agent_gets_refusals_as_tool_errors_and_keeps_going(self):
|
|
183
|
+
generator = ScriptedChatGenerator("youtube_transcript", {"url": "nocaptions"})
|
|
184
|
+
agent = Agent(chat_generator=generator, tools=self.toolset(include=["youtube_transcript"]))
|
|
185
|
+
if hasattr(agent, "warm_up"):
|
|
186
|
+
agent.warm_up()
|
|
187
|
+
result = agent.run(messages=[ChatMessage.from_user("Summarise this video")])
|
|
188
|
+
last = result["messages"][-1].text
|
|
189
|
+
self.assertIn("error=True", last)
|
|
190
|
+
self.assertIn("UPSTREAM_NOT_FOUND", last)
|
|
191
|
+
|
|
192
|
+
def test_fetcher_returns_documents_and_skips_failures(self):
|
|
193
|
+
fetcher = ScrapingRabbitTranscriptFetcher(api_key=Secret.from_token("sr_live_testkey"))
|
|
194
|
+
fetcher._client = self.client()
|
|
195
|
+
out = fetcher.run(urls=["https://youtu.be/abc", "nocaptions"])
|
|
196
|
+
self.assertEqual(len(out["documents"]), 1)
|
|
197
|
+
doc = out["documents"][0]
|
|
198
|
+
self.assertEqual(doc.content, "hello world")
|
|
199
|
+
self.assertEqual(doc.meta["video_id"], "abc")
|
|
200
|
+
self.assertEqual(out["failed"][0]["code"], "UPSTREAM_NOT_FOUND")
|
|
201
|
+
|
|
202
|
+
def test_fetcher_can_raise_and_serializes_in_a_pipeline(self):
|
|
203
|
+
fetcher = ScrapingRabbitTranscriptFetcher(api_key=Secret.from_token("sr_live_testkey"), raise_on_failure=True)
|
|
204
|
+
fetcher._client = self.client()
|
|
205
|
+
with self.assertRaises(Exception):
|
|
206
|
+
fetcher.run(urls=["nocaptions"])
|
|
207
|
+
pipeline = Pipeline()
|
|
208
|
+
pipeline.add_component("fetcher", ScrapingRabbitTranscriptFetcher())
|
|
209
|
+
restored = Pipeline.loads(pipeline.dumps())
|
|
210
|
+
self.assertIsInstance(restored.get_component("fetcher"), ScrapingRabbitTranscriptFetcher)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
if __name__ == "__main__":
|
|
214
|
+
unittest.main()
|