Module grab.base¶
Here is the heart of the library, the Grab class.
-
class
grab.base.
Grab
(document_body=None, transport=None, **kwargs)[source]¶ -
-
reset
()[source]¶ Reset all attributes which could be modified during previous request or which is not initialized yet if this is the new Grab instance.
This methods is automatically called before each network request.
-
clone
(**kwargs)[source]¶ Create clone of Grab instance.
Cloned instance will have the same state: cookies, referrer, response document data
Parameters: **kwargs – overrides settings of cloned grab instance
-
adopt
(grab)[source]¶ Copy the state of another Grab instance.
Use case: create backup of current state to the cloned instance and then restore the state from it.
-
go
(url, **kwargs)[source]¶ Go to
url
- Args:
url: could be absolute or relative. If relative then t will be appended to the absolute URL of previous request.
-
request
(**kwargs)[source]¶ Perform network request.
You can specify grab settings in
**kwargs
. Any keyword argument will be passed toself.config
.Returns:
Document
objects.
-
fake_response
(*args, **kwargs)¶
-
load_proxylist
(source, source_type, proxy_type='http', auto_init=True, auto_change=True)¶
-
make_url_absolute
(url, resolve_base=False)[source]¶ Make url absolute using previous request url as base url.
Clear all remembered cookies.
-
-
grab.base.
BaseGrab
¶ alias of
grab.base.Grab