Docs/API reference

hooks · Python

Value-cleaning and logging helpers for Python Page hooks.

Download .md
Developers2 min read9 sections
Source reference · Match your SDK version. Availability and known issues
In this guide

Purpose and lifecycle

Value-cleaning and logging helpers for Python Page hooks.

Definition and availability

Source snapshot: 1.0.0-alpha.3. Package export. Declared in source; this is not a runtime test result.

Signatures and source locations are generated from the SDK wrappers. Clean snapshots link to the recorded commit. Modified snapshots link to main, which may differ; file hashes identify the local inputs.

from crawlingo import hooks
python1 lines · copy-ready

Members

MemberKindReturn / value typeSource status
strip_whitespacemethodstrPresent in source
uppercasemethodstrPresent in source
lowercasemethodstrPresent in source
log_requestmethodNot annotated; see behavior notesPresent in source
log_responsemethodNot annotated; see behavior notesPresent in source

strip_whitespace()

Strips leading and trailing whitespace from extracted content.

Returns / value: str.

def strip_whitespace(val: str) -> str
python1 lines · copy-ready
ParameterTypeRequired / defaultMeaning
valstrRequiredExtracted string to clean or transform.

uppercase()

Converts extracted content to uppercase.

Returns / value: str.

def uppercase(val: str) -> str
python1 lines · copy-ready
ParameterTypeRequired / defaultMeaning
valstrRequiredExtracted string to clean or transform.

lowercase()

Converts extracted content to lowercase.

Returns / value: str.

def lowercase(val: str) -> str
python1 lines · copy-ready
ParameterTypeRequired / defaultMeaning
valstrRequiredExtracted string to clean or transform.

log_request()

Simple logger hook that prints the target URL before fetching.

Returns / value: Not annotated; see behavior notes.

def log_request(req)
python1 lines · copy-ready
ParameterTypeRequired / defaultMeaning
reqNot annotatedRequiredbefore_fetch RequestContext with url and headers.

log_response()

Simple logger hook that prints the HTTP status code after fetching.

Returns / value: Not annotated; see behavior notes.

def log_response(res)
python1 lines · copy-ready
ParameterTypeRequired / defaultMeaning
resNot annotatedRequiredafter_fetch ResponseContext with HTTP status.

Errors and operational limits

See the consuming API for validation and failure behavior. Types and enum declarations do not perform network requests by themselves.

Source availability, package publication and runtime validation are separate facts. These pages describe the source snapshot, not a claim that all platforms or every API path have passed production acceptance.