gws.lib.net

Source code: gws.lib.net

Package Contents

gws.lib.net.add_params(url: str, params: dict = None, **kwargs) str
exception gws.lib.net.Error

Bases: gws.Error

GWS error.

gws.lib.net.extract_params(url: str) tuple[str, dict]
gws.lib.net.http_request(url, **kwargs) HTTPResponse
exception gws.lib.net.HTTPError

Bases: Error

GWS error.

class gws.lib.net.HTTPResponse(ok: bool, url: str, res: requests.Response = None, text: str = None, status_code=0)
property text: str
raise_if_failed()
gws.lib.net.is_abs_url(url)
gws.lib.net.make_qs(x) str

Convert a dict/list to a query string.

For each item in x, if it’s a list, join it with a comma, stringify and in utf8.

Parameters:

x – Value, which can be a dict’able or a list of key,value pairs.

Returns:

The query string.

gws.lib.net.make_url(u: Url | dict | None = None, **kwargs) str
gws.lib.net.parse_qs(x) dict
gws.lib.net.parse_url(url: str, **kwargs) Url

Parse a string url and return an Url object

gws.lib.net.quote_param(s: str) str
gws.lib.net.quote_path(s: str) str
exception gws.lib.net.Timeout

Bases: Error

GWS error.

gws.lib.net.unquote(s: str) str
class gws.lib.net.Url(*args, **kwargs)

Bases: gws.Data

Basic data object.

This object can be instantiated by passing one or or dict arguments and/or keyword args. All dicts keys and keywords become attributes of the object.

Accessing an undefined attribute returns None and no error is raised, unless the attribute name starts with an underscore.

fragment: str
hostname: str
netloc: str
params: dict
password: str
path: str
pathparts: dict
port: str
qsl: list
query: str
scheme: str
url: str
username: str