MCPcopy Create free account
hub / github.com/apify/crawlee-python / from_model

Method from_model

src/crawlee/sessions/_session.py:79–82  ·  view source on GitHub ↗

Initialize a new instance from a `SessionModel`.

(cls, model: SessionModel)

Source from the content-addressed store, hash-verified

77
78 @classmethod
79 def from_model(cls, model: SessionModel) -> Session:
80 """Initialize a new instance from a `SessionModel`."""
81 cookies = SessionCookies(model.cookies)
82 return cls(**model.model_dump(exclude={'cookies'}), cookies=cookies)
83
84 def __repr__(self) -> str:
85 """Get a string representation."""

Callers 2

SessionPoolModelClass · 0.80
test_session_get_stateFunction · 0.80

Calls 1

SessionCookiesClass · 0.90

Tested by 1

test_session_get_stateFunction · 0.64