GrlNet.Wc¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/c |
Use cache |
||
r/w/c |
Size of cache in Mb |
||
r/w |
Log level for HTTP connections |
||
r/w |
Time to throttle connections |
||
r/w/c |
User agent identifier |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class GrlNet.Wc(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new()¶
- Returns:
a new allocated instance of
GrlNet.Wc
. DoGObject.Object.unref
() after use it.- Return type:
Creates a new
GrlNet.Wc
.
- flush_delayed_requests()¶
This method will flush all the pending request in the queue.
- request_async(uri, cancellable, callback, *user_data)¶
- Parameters:
uri (
str
) – The URI of the resource to requestcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
instance orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – The callback when the result is ready
Request the fetching of a web resource given the uri. This request is asynchronous, thus the result will be returned within the callback.
- request_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – The result of the request- Raises:
- Returns:
True
if the request was successfull. IfFalse
an error occurred.- content:
The contents of the resource
- Return type:
Finishes an asynchronous load of the file’s contents. The contents are placed in contents, and length is set to the size of the contents string.
The content address will be invalidated at the next request. So if you want to keep it, please copy it into another address.
- request_with_headers_async(uri, headers, cancellable, callback, *user_data)¶
- Parameters:
uri (
str
) – The URI of the resource to requestheaders ({
str
:str
} orNone
) – a set of additional HTTP headers for this request orNone
to ignorecancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
instance orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – The callback when the result is ready
Request the fetching of a web resource given the uri. This request is asynchronous, thus the result will be returned within the callback.
New in version 0.2.2.
- set_cache(use_cache)¶
- Parameters:
use_cache (
bool
) – if cache must be used or not
Sets if cache must be used. Note that this will only work if caching is supporting. If sets
True
, a new cache will be created. If sets toFalse
, current cache is clean and removed.New in version 0.1.12.
- set_cache_size(cache_size)¶
- Parameters:
cache_size (
int
) – size of cache (in Mb)
Sets the new maximum size of cache, in Megabytes. Default value is 10. Using 0 means no cache will be done.
New in version 0.1.12.
- set_log_level(log_level)¶
- Parameters:
log_level (
int
) – the libsoup log level to set [0,3]
Setting the log level the logger feature is added into the libsoup session.
- set_throttling(throttling)¶
- Parameters:
throttling (
int
) – the number of seconds to wait between requests
Setting this property, the
GrlNet.Wc
will queue all the requests and will dispatch them with a pause between them of this value.Note that if the grl-net library was compiled against libsoup3, changing the throttling configuration will show a warning if done after the first request.
Property Details¶
- GrlNet.Wc.props.cache¶
-
Use cache
- GrlNet.Wc.props.cache_size¶
-
Size of cache in Mb
- GrlNet.Wc.props.loglevel¶
-
Log level for HTTP connections
- GrlNet.Wc.props.throttling¶
-
Time to throttle connections