Skip to content

Commit 707a8a8

Browse files
committed
Use regex instead of re.
Add helper class for input keys Add top level Input class for handling actor inputs.
1 parent 234b6fb commit 707a8a8

File tree

7 files changed

+261
-107
lines changed

7 files changed

+261
-107
lines changed

poetry.lock

Lines changed: 115 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ lazy-object-proxy = ">=1.10.0"
5555
scrapy = { version = ">=2.11.0", optional = true }
5656
typing-extensions = ">=4.1.0"
5757
websockets = ">=10.0 <14.0.0"
58+
regex = "^2024.11.6"
5859

5960
[tool.poetry.group.dev.dependencies]
6061
build = "~1.2.0"
@@ -72,6 +73,7 @@ pytest-xdist = "~3.6.0"
7273
respx = "~0.21.0"
7374
ruff = "~0.7.0"
7475
setuptools = "~75.0.0" # setuptools are used by pytest but not explicitly required
76+
types-regex = "^2024.11.6.20241108"
7577

7678
[tool.poetry.extras]
7779
scrapy = ["scrapy"]

src/apify/_actor.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from crawlee import service_container
1717
from crawlee.events._types import Event, EventPersistStateData
1818

19-
from apify._actor_inputs import _create_request_list
2019
from apify._configuration import Configuration
2120
from apify._consts import EVENT_LISTENERS_TIMEOUT
2221
from apify._crypto import decrypt_input_secrets, load_private_key
@@ -32,9 +31,7 @@
3231
import logging
3332
from types import TracebackType
3433

35-
from crawlee.http_clients import BaseHttpClient
3634
from crawlee.proxy_configuration import _NewUrlFunction
37-
from crawlee.storages import RequestList
3835

3936
from apify._models import Webhook
4037

@@ -977,22 +974,6 @@ async def create_proxy_configuration(
977974

978975
return proxy_configuration
979976

980-
@staticmethod
981-
async def create_request_list(
982-
*, actor_start_urls_input: list[dict[str, Any]], http_client: BaseHttpClient | None = None
983-
) -> RequestList:
984-
"""Creates request list from Actor input requestListSources. This accepts list of urls and requests_from_url.
985-
986-
Example:
987-
actor_start_urls_input = [
988-
# Gather urls from response body.
989-
{'requests_from_url': 'https://crawlee.dev/file.txt', 'method': 'GET'},
990-
# Directly include this url.
991-
{'url': 'https://crawlee.dev', 'method': 'GET'}
992-
]
993-
"""
994-
return await _create_request_list(actor_start_urls_input=actor_start_urls_input, http_client=http_client)
995-
996977

997978
Actor = cast(_ActorType, Proxy(_ActorType))
998979
"""The entry point of the SDK, through which all the Actor operations should be done."""

src/apify/storages/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
from crawlee.storages import Dataset, KeyValueStore, RequestQueue
22

3-
__all__ = ['Dataset', 'KeyValueStore', 'RequestQueue']
3+
from ._actor_inputs import Input
4+
5+
__all__ = ['Dataset', 'KeyValueStore', 'RequestQueue', 'Input']

0 commit comments

Comments
 (0)