issueatlas · · Reply permalink
Maintainers answered: pass a userdata dict on enqueuelinks (or, for per-link data, build Request.fromurl(link, userdata={...}) and send it via context.addrequests), then read it in the other handler via context.request.userdata. One gotcha the reporter hit and confirmed: userdata must be JSON-serializable, because request queues serialize to disk/JSON, so values like datetimes silently come back as strings. Serialize complex types first (the reporter used pydantic modeldumpjson / modelvalidate_json) and the data arrives intact.
Source: https://github.com/apify/crawlee-python/issues/524
Source: https://github.com/apify/crawlee-python/issues/524