apify-sdk-python
Index
Classes
Properties
Interfaces
Data structures
Methods
Other
Properties
Actor
Methods
apply_apify_settings
{"content": ["Integrates Apify configuration into a Scrapy project settings.\n\nNote: The function directly modifies the passed
settingsobject and also returns it.\n", {"Parameters
keyword-onlysettings: Settings | None = None
keyword-onlyproxy_config: dict | None = None
Returns Settings
docs_group
{"content": ["Mark a symbol for rendering and grouping in documentation.\n\nThis decorator is used solely for documentation purposes and does not modify the behavior\nof the decorated callable.\n", {"
Parameters
group_name: GroupName
Returns Callable
docs_name
{"content": ["Rename a symbol for documentation rendering.\n\nThis decorator modifies only the displayed name of the symbol in the generated documentation\nand does not affect its runtime behavior.\n", {"
Parameters
symbol_name: str
Returns Callable
encode_base62
{"content": ["Encode the given number to base62."]}
Parameters
num: int
Returns str
from_gzip
{"content": ["Load a dictionary from a gzip-compressed byte stream."]}
Parameters
gzip_bytes: bytes
Returns dict
get_basic_auth_header
{"content": ["Generate a basic authentication header for the given username and password."]}
Parameters
username: str
password: str
auth_encoding: str = 'latin-1'
Returns bytes
get_kvs_name
{"content": ["Get the key value store name for a spider.\n\nThe key value store name is derived from the spider name by replacing all special characters\nwith hyphens and trimming leading and trailing hyphens. The resulting name is prefixed with\n'httpcache-' and truncated to the maximum length.\n\nThe documentation\nabout storages\nmentions that names can be up to 63 characters long, so the default max length is set to 60.\n\nSuch naming isn't unique per spider, but should be sufficiently unique for most use cases.\nThe name of the key value store should indicate to which spider it belongs, e.g. in\nthe listing in the Apify's console.\n", {"
Parameters
spider_name: str
max_length: int = 60
Returns str
[{"param"
initialize_logging
{"content": ["Configure logging for Apify Actors and adjust Scrapy's logging settings."]}
Returns None
read_gzip_time
{"content": ["Read the modification time from a gzip-compressed byte stream without decompressing the data."]}
Parameters
gzip_bytes: bytes
Returns int
run_scrapy_actor
{"content": ["Start Twisted's reactor and execute the provided Actor coroutine.\n\nThis function initiates the Twisted reactor and runs the given asyncio coroutine (typically the\nActor's main) by converting it to a Deferred. This bridges the asyncio and Twisted event loops,\nenabling the Apify and Scrapy integration to work together."]}
Parameters
coro: Coroutine
Returns None
to_apify_request
{"content": ["Convert a Scrapy request to an Apify request.\n", {"
Parameters
scrapy_request: ScrapyRequest
spider: Spider
Returns ApifyRequest | None
to_gzip
{"content": ["Dump a dictionary to a gzip-compressed byte stream."]}
Parameters
data: dict
mtime: int | None = None
Returns bytes
to_scrapy_request
{"content": ["Convert an Apify request to a Scrapy request.\n", {"
Parameters
apify_request: ApifyRequest
spider: Spider
Returns ScrapyRequest
{"content": ["The entry point of the SDK, through which all the Actor operations should be done."]}