sayou-connector 0.3.7__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.
@@ -0,0 +1,211 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
208
+
209
+ # MacOS
210
+ .DS_Store
211
+
@@ -0,0 +1,303 @@
1
+ Metadata-Version: 2.4
2
+ Name: sayou-connector
3
+ Version: 0.3.7
4
+ Summary: Connector components for the Sayou Data Platform
5
+ Project-URL: Homepage, https://www.sayouzone.com/
6
+ Project-URL: Documentation, https://sayouzone.github.io/sayou-fabric/
7
+ Project-URL: Repository, https://github.com/sayouzone/sayou-fabric
8
+ Author-email: Sayouzone <contact@sayouzone.com>
9
+ License: Apache License
10
+ Version 2.0, January 2004
11
+ http://www.apache.org/licenses/
12
+
13
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
14
+
15
+ 1. Definitions.
16
+
17
+ "License" shall mean the terms and conditions for use, reproduction,
18
+ and distribution as defined by Sections 1 through 9 of this document.
19
+
20
+ "Licensor" shall mean the copyright owner or entity authorized by
21
+ the copyright owner that is granting the License.
22
+
23
+ "Legal Entity" shall mean the union of the acting entity and all
24
+ other entities that control, are controlled by, or are under common
25
+ control with that entity. For the purposes of this definition,
26
+ "control" means (i) the power, direct or indirect, to cause the
27
+ direction or management of such entity, whether by contract or
28
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
29
+ outstanding shares, or (iii) beneficial ownership of such entity.
30
+
31
+ "You" (or "Your") shall mean an individual or Legal Entity
32
+ exercising permissions granted by this License.
33
+
34
+ "Source" form shall mean the preferred form for making modifications,
35
+ including but not limited to software source code, documentation
36
+ source, and configuration files.
37
+
38
+ "Object" form shall mean any form resulting from mechanical
39
+ transformation or translation of a Source form, including but
40
+ not limited to compiled object code, generated documentation,
41
+ and conversions to other media types.
42
+
43
+ "Work" shall mean the work of authorship, whether in Source or
44
+ Object form, made available under the License, as indicated by a
45
+ copyright notice that is included in or attached to the work
46
+ (an example is provided in the Appendix below).
47
+
48
+ "Derivative Works" shall mean any work, whether in Source or Object
49
+ form, that is based on (or derived from) the Work and for which the
50
+ editorial revisions, annotations, elaborations, or other modifications
51
+ represent, as a whole, an original work of authorship. For the purposes
52
+ of this License, Derivative Works shall not include works that remain
53
+ separable from, or merely link (or bind by name) to the interfaces of,
54
+ the Work and Derivative Works thereof.
55
+
56
+ "Contribution" shall mean any work of authorship, including
57
+ the original version of the Work and any modifications or additions
58
+ to that Work or Derivative Works thereof, that is intentionally
59
+ submitted to Licensor for inclusion in the Work by the copyright owner
60
+ or by an individual or Legal Entity authorized to submit on behalf of
61
+ the copyright owner. For the purposes of this definition, "submitted"
62
+ means any form of electronic, verbal, or written communication sent
63
+ to the Licensor or its representatives, including but not limited to
64
+ communication on electronic mailing lists, source code control systems,
65
+ and issue tracking systems that are managed by, or on behalf of, the
66
+ Licensor for the purpose of discussing and improving the Work, but
67
+ excluding communication that is conspicuously marked or otherwise
68
+ designated in writing by the copyright owner as "Not a Contribution."
69
+
70
+ "Contributor" shall mean Licensor and any individual or Legal Entity
71
+ on behalf of whom a Contribution has been received by Licensor and
72
+ subsequently incorporated within the Work.
73
+
74
+ 2. Grant of Copyright License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ copyright license to reproduce, prepare Derivative Works of,
78
+ publicly display, publicly perform, sublicense, and distribute the
79
+ Work and such Derivative Works in Source or Object form.
80
+
81
+ 3. Grant of Patent License. Subject to the terms and conditions of
82
+ this License, each Contributor hereby grants to You a perpetual,
83
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
84
+ (except as stated in this section) patent license to make, have made,
85
+ use, offer to sell, sell, import, and otherwise transfer the Work,
86
+ where such license applies only to those patent claims licensable
87
+ by such Contributor that are necessarily infringed by their
88
+ Contribution(s) alone or by combination of their Contribution(s)
89
+ with the Work to which such Contribution(s) was submitted. If You
90
+ institute patent litigation against any entity (including a
91
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
92
+ or a Contribution incorporated within the Work constitutes direct
93
+ or contributory patent infringement, then any patent licenses
94
+ granted to You under this License for that Work shall terminate
95
+ as of the date such litigation is filed.
96
+
97
+ 4. Redistribution. You may reproduce and distribute copies of the
98
+ Work or Derivative Works thereof in any medium, with or without
99
+ modifications, and in Source or Object form, provided that You
100
+ meet the following conditions:
101
+
102
+ (a) You must give any other recipients of the Work or
103
+ Derivative Works a copy of this License; and
104
+
105
+ (b) You must cause any modified files to carry prominent notices
106
+ stating that You changed the files; and
107
+
108
+ (c) You must retain, in the Source form of any Derivative Works
109
+ that You distribute, all copyright, patent, trademark, and
110
+ attribution notices from the Source form of the Work,
111
+ excluding those notices that do not pertain to any part of
112
+ the Derivative Works; and
113
+
114
+ (d) If the Work includes a "NOTICE" text file as part of its
115
+ distribution, then any Derivative Works that You distribute must
116
+ include a readable copy of the attribution notices contained
117
+ within such NOTICE file, excluding those notices that do not
118
+ pertain to any part of the Derivative Works, in at least one
119
+ of the following places: within a NOTICE text file distributed
120
+ as part of the Derivative Works; within the Source form or
121
+ documentation, if provided along with the Derivative Works; or,
122
+ within a display generated by the Derivative Works, if and
123
+ wherever such third-party notices normally appear. The contents
124
+ of the NOTICE file are for informational purposes only and
125
+ do not modify the License. You may add Your own attribution
126
+ notices within Derivative Works that You distribute, alongside
127
+ or as an addendum to the NOTICE text from the Work, provided
128
+ that such additional attribution notices cannot be construed
129
+ as modifying the License.
130
+
131
+ You may add Your own copyright statement to Your modifications and
132
+ may provide additional or different license terms and conditions
133
+ for use, reproduction, or distribution of Your modifications, or
134
+ for any such Derivative Works as a whole, provided Your use,
135
+ reproduction, and distribution of the Work otherwise complies with
136
+ the conditions stated in this License.
137
+
138
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
139
+ any Contribution intentionally submitted for inclusion in the Work
140
+ by You to the Licensor shall be under the terms and conditions of
141
+ this License, without any additional terms or conditions.
142
+ Notwithstanding the above, nothing herein shall supersede or modify
143
+ the terms of any separate license agreement you may have executed
144
+ with Licensor regarding such Contributions.
145
+
146
+ 6. Trademarks. This License does not grant permission to use the trade
147
+ names, trademarks, service marks, or product names of the Licensor,
148
+ except as required for reasonable and customary use in describing the
149
+ origin of the Work and reproducing the content of the NOTICE file.
150
+
151
+ 7. Disclaimer of Warranty. Unless required by applicable law or
152
+ agreed to in writing, Licensor provides the Work (and each
153
+ Contributor provides its Contributions) on an "AS IS" BASIS,
154
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
155
+ implied, including, without limitation, any warranties or conditions
156
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
157
+ PARTICULAR PURPOSE. You are solely responsible for determining the
158
+ appropriateness of using or redistributing the Work and assume any
159
+ risks associated with Your exercise of permissions under this License.
160
+
161
+ 8. Limitation of Liability. In no event and under no legal theory,
162
+ whether in tort (including negligence), contract, or otherwise,
163
+ unless required by applicable law (such as deliberate and grossly
164
+ negligent acts) or agreed to in writing, shall any Contributor be
165
+ liable to You for damages, including any direct, indirect, special,
166
+ incidental, or consequential damages of any character arising as a
167
+ result of this License or out of the use or inability to use the
168
+ Work (including but not limited to damages for loss of goodwill,
169
+ work stoppage, computer failure or malfunction, or any and all
170
+ other commercial damages or losses), even if such Contributor
171
+ has been advised of the possibility of such damages.
172
+
173
+ 9. Accepting Warranty or Additional Liability. While redistributing
174
+ the Work or Derivative Works thereof, You may choose to offer,
175
+ and charge a fee for, acceptance of support, warranty, indemnity,
176
+ or other liability obligations and/or rights consistent with this
177
+ License. However, in accepting such obligations, You may act only
178
+ on Your own behalf and on Your sole responsibility, not on behalf
179
+ of any other Contributor, and only if You agree to indemnify,
180
+ defend, and hold each Contributor harmless for any liability
181
+ incurred by, or claims asserted against, such Contributor by reason
182
+ of your accepting any such warranty or additional liability.
183
+
184
+ END OF TERMS AND CONDITIONS
185
+
186
+ APPENDIX: How to apply the Apache License to your work.
187
+
188
+ To apply the Apache License to your work, attach the following
189
+ boilerplate notice, with the fields enclosed by brackets "[]"
190
+ replaced with your own identifying information. (Don't include
191
+ the brackets!) The text should be enclosed in the appropriate
192
+ comment syntax for the file format. We also recommend that a
193
+ file or class name and description of purpose be included on the
194
+ same "printed page" as the copyright notice for easier
195
+ identification within third-party archives.
196
+
197
+ Copyright [yyyy] [name of copyright owner]
198
+
199
+ Licensed under the Apache License, Version 2.0 (the "License");
200
+ you may not use this file except in compliance with the License.
201
+ You may obtain a copy of the License at
202
+
203
+ http://www.apache.org/licenses/LICENSE-2.0
204
+
205
+ Unless required by applicable law or agreed to in writing, software
206
+ distributed under the License is distributed on an "AS IS" BASIS,
207
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
208
+ See the License for the specific language governing permissions and
209
+ limitations under the License.
210
+ Classifier: License :: OSI Approved :: Apache Software License
211
+ Classifier: Operating System :: OS Independent
212
+ Classifier: Programming Language :: Python :: 3.9
213
+ Classifier: Programming Language :: Python :: 3.10
214
+ Classifier: Programming Language :: Python :: 3.11
215
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
216
+ Requires-Python: >=3.9
217
+ Requires-Dist: sayou-core~=0.3.0
218
+ Description-Content-Type: text/markdown
219
+
220
+ # sayou-connector
221
+
222
+ [![PyPI version](https://img.shields.io/pypi/v/sayou-connector.svg?color=blue)](https://pypi.org/project/sayou-connector/)
223
+ [![License](https://img.shields.io/badge/License-Apache%202.0-red.svg)](https://www.apache.org/licenses/LICENSE-2.0)
224
+ [![Docs](https://img.shields.io/badge/docs-mkdocs-success.svg?logo=materialformkdocs)](https://sayouzone.github.io/sayou-fabric/library-guides/connector/)
225
+
226
+ **The Universal Data Ingestion Engine for Sayou Fabric.**
227
+
228
+ `sayou-connector` provides a unified interface to fetch data from diverse sources—Local Files, Web URLs, and Databases—normalizing everything into a standard format called **SayouPacket**.
229
+
230
+ It separates the logic of **Navigation** (Generator) from **Retrieval** (Fetcher), enabling complex recursive crawling and pagination strategies out of the box.
231
+
232
+ ## 💡 Core Philosophy
233
+
234
+ **"Navigate First, Fetch Later."**
235
+
236
+ Data collection is not just about downloading; it's about discovery. We decouple the responsibility into two roles:
237
+
238
+ 1. **Generator (Navigator):** The "Brain". It decides *what* to fetch next (e.g., calculates DB offsets, finds next page links) and yields a Task.
239
+ 2. **Fetcher (Driver):** The "Muscle". It executes the actual retrieval (e.g., HTTP GET, SQL Query) and returns a Packet.
240
+
241
+ This separation enables the **Feedback Loop**, where the result of a fetch (e.g., found links) feeds back into the Generator to discover more targets.
242
+
243
+ ## 📦 Installation
244
+
245
+ ```bash
246
+ pip install sayou-connector
247
+ ```
248
+
249
+ ## ⚡ Quick Start
250
+
251
+ The `ConnectorPipeline` manages the feedback loop between Generators and Fetchers.
252
+
253
+ ```python
254
+ from sayou.connector.pipeline import ConnectorPipeline
255
+
256
+ def run_demo():
257
+ # 1. Initialize Pipeline
258
+ pipeline = ConnectorPipeline()
259
+ pipeline.initialize()
260
+
261
+ # 2. Run (Example: Web Crawling)
262
+ print("Starting Web Crawl...")
263
+
264
+ # Returns an iterator of 'SayouPacket' objects
265
+ packets = pipeline.run(
266
+ source="https://news.daum.net/tech",
267
+ strategy="requests",
268
+ link_pattern=r"https://v\.daum\.net/v/\d+",
269
+ max_depth=1
270
+ )
271
+
272
+ # 3. Process Results (Stream)
273
+ for packet in packets:
274
+ if packet.success:
275
+ print(f"[Fetched] {packet.task.uri}")
276
+ # packet.data contains the extracted content (dict, bytes, etc.)
277
+ print(f" Data: {str(packet.data)[:50]}...")
278
+ else:
279
+ print(f"[Error] {packet.error}")
280
+
281
+ if __name__ == "__main__":
282
+ run_demo()
283
+ ```
284
+
285
+ ## 🔑 Key Concepts
286
+
287
+ ### Generators
288
+ * **`FileGenerator`**: Recursively scans directories to find files matching extensions or patterns.
289
+ * **`SqlGenerator`**: Generates paginated SQL queries (LIMIT/OFFSET) to fetch large tables in batches.
290
+ * **`WebCrawlGenerator`**: Manages a URL frontier queue for BFS/DFS web crawling with depth control.
291
+
292
+ ### Fetchers
293
+ * **`FileFetcher`**: Reads binary or text content from the local file system.
294
+ * **`SqliteFetcher`**: Executes SQL queries against SQLite databases securely.
295
+ * **`SimpleWebFetcher`**: Fetches HTML pages and extracts data/links using BeautifulSoup.
296
+
297
+ ## 🤝 Contributing
298
+
299
+ We welcome contributions for new Fetchers (e.g., `S3Fetcher`, `KafkaFetcher`) or Generators (e.g., `SitemapGenerator`)!
300
+
301
+ ## 📜 License
302
+
303
+ Apache 2.0 License © 2025 Sayouzone
@@ -0,0 +1,84 @@
1
+ # sayou-connector
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/sayou-connector.svg?color=blue)](https://pypi.org/project/sayou-connector/)
4
+ [![License](https://img.shields.io/badge/License-Apache%202.0-red.svg)](https://www.apache.org/licenses/LICENSE-2.0)
5
+ [![Docs](https://img.shields.io/badge/docs-mkdocs-success.svg?logo=materialformkdocs)](https://sayouzone.github.io/sayou-fabric/library-guides/connector/)
6
+
7
+ **The Universal Data Ingestion Engine for Sayou Fabric.**
8
+
9
+ `sayou-connector` provides a unified interface to fetch data from diverse sources—Local Files, Web URLs, and Databases—normalizing everything into a standard format called **SayouPacket**.
10
+
11
+ It separates the logic of **Navigation** (Generator) from **Retrieval** (Fetcher), enabling complex recursive crawling and pagination strategies out of the box.
12
+
13
+ ## 💡 Core Philosophy
14
+
15
+ **"Navigate First, Fetch Later."**
16
+
17
+ Data collection is not just about downloading; it's about discovery. We decouple the responsibility into two roles:
18
+
19
+ 1. **Generator (Navigator):** The "Brain". It decides *what* to fetch next (e.g., calculates DB offsets, finds next page links) and yields a Task.
20
+ 2. **Fetcher (Driver):** The "Muscle". It executes the actual retrieval (e.g., HTTP GET, SQL Query) and returns a Packet.
21
+
22
+ This separation enables the **Feedback Loop**, where the result of a fetch (e.g., found links) feeds back into the Generator to discover more targets.
23
+
24
+ ## 📦 Installation
25
+
26
+ ```bash
27
+ pip install sayou-connector
28
+ ```
29
+
30
+ ## ⚡ Quick Start
31
+
32
+ The `ConnectorPipeline` manages the feedback loop between Generators and Fetchers.
33
+
34
+ ```python
35
+ from sayou.connector.pipeline import ConnectorPipeline
36
+
37
+ def run_demo():
38
+ # 1. Initialize Pipeline
39
+ pipeline = ConnectorPipeline()
40
+ pipeline.initialize()
41
+
42
+ # 2. Run (Example: Web Crawling)
43
+ print("Starting Web Crawl...")
44
+
45
+ # Returns an iterator of 'SayouPacket' objects
46
+ packets = pipeline.run(
47
+ source="https://news.daum.net/tech",
48
+ strategy="requests",
49
+ link_pattern=r"https://v\.daum\.net/v/\d+",
50
+ max_depth=1
51
+ )
52
+
53
+ # 3. Process Results (Stream)
54
+ for packet in packets:
55
+ if packet.success:
56
+ print(f"[Fetched] {packet.task.uri}")
57
+ # packet.data contains the extracted content (dict, bytes, etc.)
58
+ print(f" Data: {str(packet.data)[:50]}...")
59
+ else:
60
+ print(f"[Error] {packet.error}")
61
+
62
+ if __name__ == "__main__":
63
+ run_demo()
64
+ ```
65
+
66
+ ## 🔑 Key Concepts
67
+
68
+ ### Generators
69
+ * **`FileGenerator`**: Recursively scans directories to find files matching extensions or patterns.
70
+ * **`SqlGenerator`**: Generates paginated SQL queries (LIMIT/OFFSET) to fetch large tables in batches.
71
+ * **`WebCrawlGenerator`**: Manages a URL frontier queue for BFS/DFS web crawling with depth control.
72
+
73
+ ### Fetchers
74
+ * **`FileFetcher`**: Reads binary or text content from the local file system.
75
+ * **`SqliteFetcher`**: Executes SQL queries against SQLite databases securely.
76
+ * **`SimpleWebFetcher`**: Fetches HTML pages and extracts data/links using BeautifulSoup.
77
+
78
+ ## 🤝 Contributing
79
+
80
+ We welcome contributions for new Fetchers (e.g., `S3Fetcher`, `KafkaFetcher`) or Generators (e.g., `SitemapGenerator`)!
81
+
82
+ ## 📜 License
83
+
84
+ Apache 2.0 License © 2025 Sayouzone