webcrawlerapi 2.1.2__tar.gz → 2.1.3__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.
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/PKG-INFO +1 -1
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/setup.py +1 -1
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/tests/test_client.py +0 -32
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/webcrawlerapi/client.py +0 -10
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/webcrawlerapi.egg-info/PKG-INFO +1 -1
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/README.md +0 -0
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/pyproject.toml +0 -0
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/setup.cfg +0 -0
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/tests/__init__.py +0 -0
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/tests/test_models.py +0 -0
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/webcrawlerapi/__init__.py +0 -0
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/webcrawlerapi/models.py +0 -0
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/webcrawlerapi.egg-info/SOURCES.txt +0 -0
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/webcrawlerapi.egg-info/dependency_links.txt +0 -0
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/webcrawlerapi.egg-info/requires.txt +0 -0
- {webcrawlerapi-2.1.2 → webcrawlerapi-2.1.3}/webcrawlerapi.egg-info/top_level.txt +0 -0
|
@@ -13,7 +13,6 @@ from webcrawlerapi.models import (
|
|
|
13
13
|
ScrapeId,
|
|
14
14
|
ScrapeResponse,
|
|
15
15
|
ScrapeResponseError,
|
|
16
|
-
UploadS3Action,
|
|
17
16
|
WebCrawlerApiError,
|
|
18
17
|
)
|
|
19
18
|
|
|
@@ -99,37 +98,6 @@ class TestWebCrawlerAPI:
|
|
|
99
98
|
assert payload["items_limit"] == 5
|
|
100
99
|
assert payload["respect_robots_txt"] is True
|
|
101
100
|
|
|
102
|
-
@responses.activate
|
|
103
|
-
def test_crawl_async_with_actions(self, client):
|
|
104
|
-
"""Test crawl_async with S3 upload action."""
|
|
105
|
-
responses.add(
|
|
106
|
-
responses.POST,
|
|
107
|
-
"https://api.test.com/v1/crawl",
|
|
108
|
-
json={"id": "crawl-456"},
|
|
109
|
-
status=200,
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
s3_action = UploadS3Action(
|
|
113
|
-
path="crawl-results/",
|
|
114
|
-
access_key_id="AKIAEXAMPLE",
|
|
115
|
-
secret_access_key="secret123",
|
|
116
|
-
bucket="my-bucket",
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
result = client.crawl_async(url="https://example.com", actions=[s3_action])
|
|
120
|
-
|
|
121
|
-
assert result.id == "crawl-456"
|
|
122
|
-
|
|
123
|
-
# Verify action in payload
|
|
124
|
-
request = responses.calls[0].request
|
|
125
|
-
import json
|
|
126
|
-
|
|
127
|
-
payload = json.loads(request.body)
|
|
128
|
-
assert "actions" in payload
|
|
129
|
-
assert len(payload["actions"]) == 1
|
|
130
|
-
assert payload["actions"][0]["type"] == "upload_s3"
|
|
131
|
-
assert payload["actions"][0]["bucket"] == "my-bucket"
|
|
132
|
-
|
|
133
101
|
@responses.activate
|
|
134
102
|
def test_crawl_async_with_max_age(self, client):
|
|
135
103
|
"""Test crawl_async includes max_age when provided."""
|
|
@@ -68,7 +68,6 @@ class WebCrawlerAPI:
|
|
|
68
68
|
webhook_url: Optional[str] = None,
|
|
69
69
|
whitelist_regexp: Optional[str] = None,
|
|
70
70
|
blacklist_regexp: Optional[str] = None,
|
|
71
|
-
actions: Optional[Union[Action, List[Action]]] = None,
|
|
72
71
|
respect_robots_txt: bool = False,
|
|
73
72
|
main_content_only: bool = False,
|
|
74
73
|
max_depth: Optional[int] = None,
|
|
@@ -87,7 +86,6 @@ class WebCrawlerAPI:
|
|
|
87
86
|
webhook_url (str, optional): URL for webhook notifications
|
|
88
87
|
whitelist_regexp (str, optional): Regex pattern for URL whitelist
|
|
89
88
|
blacklist_regexp (str, optional): Regex pattern for URL blacklist
|
|
90
|
-
actions (Action or List[Action], optional): Actions to perform during crawling
|
|
91
89
|
respect_robots_txt (bool): Whether to respect robots.txt (default: False)
|
|
92
90
|
main_content_only (bool): Whether to extract only main content (default: False)
|
|
93
91
|
max_depth (int, optional): Maximum crawl depth (0 = seed only, 1 = seed + direct links)
|
|
@@ -131,9 +129,6 @@ class WebCrawlerAPI:
|
|
|
131
129
|
payload["main_content_only"] = main_content_only
|
|
132
130
|
if keep_query_params is not None:
|
|
133
131
|
payload["keep_query_params"] = keep_query_params
|
|
134
|
-
if actions:
|
|
135
|
-
action_list = [actions] if not isinstance(actions, list) else actions
|
|
136
|
-
payload["actions"] = [vars(action) for action in action_list]
|
|
137
132
|
|
|
138
133
|
response = self.session.post(
|
|
139
134
|
urljoin(self.base_url, f"/{CRAWLER_VERSION}/crawl"), json=payload
|
|
@@ -237,7 +232,6 @@ class WebCrawlerAPI:
|
|
|
237
232
|
webhook_url: Optional[str] = None,
|
|
238
233
|
whitelist_regexp: Optional[str] = None,
|
|
239
234
|
blacklist_regexp: Optional[str] = None,
|
|
240
|
-
actions: Optional[Union[Action, List[Action]]] = None,
|
|
241
235
|
respect_robots_txt: bool = False,
|
|
242
236
|
main_content_only: bool = False,
|
|
243
237
|
max_depth: Optional[int] = None,
|
|
@@ -256,7 +250,6 @@ class WebCrawlerAPI:
|
|
|
256
250
|
webhook_url (str, optional): URL for webhook notifications
|
|
257
251
|
whitelist_regexp (str, optional): Regex pattern for URL whitelist
|
|
258
252
|
blacklist_regexp (str, optional): Regex pattern for URL blacklist
|
|
259
|
-
actions (Action or List[Action], optional): Actions to perform during crawling
|
|
260
253
|
respect_robots_txt (bool): Whether to respect robots.txt (default: False)
|
|
261
254
|
main_content_only (bool): Whether to extract only main content (default: False)
|
|
262
255
|
max_depth (int, optional): Maximum crawl depth
|
|
@@ -279,7 +272,6 @@ class WebCrawlerAPI:
|
|
|
279
272
|
webhook_url=webhook_url,
|
|
280
273
|
whitelist_regexp=whitelist_regexp,
|
|
281
274
|
blacklist_regexp=blacklist_regexp,
|
|
282
|
-
actions=actions,
|
|
283
275
|
respect_robots_txt=respect_robots_txt,
|
|
284
276
|
main_content_only=main_content_only,
|
|
285
277
|
max_depth=max_depth,
|
|
@@ -315,7 +307,6 @@ class WebCrawlerAPI:
|
|
|
315
307
|
webhook_url: Optional[str] = None,
|
|
316
308
|
whitelist_regexp: Optional[str] = None,
|
|
317
309
|
blacklist_regexp: Optional[str] = None,
|
|
318
|
-
actions: Optional[Union[Action, List[Action]]] = None,
|
|
319
310
|
respect_robots_txt: bool = False,
|
|
320
311
|
main_content_only: bool = False,
|
|
321
312
|
max_depth: Optional[int] = None,
|
|
@@ -340,7 +331,6 @@ class WebCrawlerAPI:
|
|
|
340
331
|
webhook_url=webhook_url,
|
|
341
332
|
whitelist_regexp=whitelist_regexp,
|
|
342
333
|
blacklist_regexp=blacklist_regexp,
|
|
343
|
-
actions=actions,
|
|
344
334
|
respect_robots_txt=respect_robots_txt,
|
|
345
335
|
main_content_only=main_content_only,
|
|
346
336
|
max_depth=max_depth,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|