human_requests.abstraction.http

Classes

HttpMethod

Represents an HTTP method.

URL

A dataclass containing the parsed URL components.

Proxy

Универсальный класс для работы с прокси в двух форматах:

Module Contents

class HttpMethod(*args, **kwds)[source]

Represents an HTTP method.

GET = 'GET'[source]

Retrieves data from a server. It only reads data and does not modify it.

POST = 'POST'[source]

Submits data to a server to create a new resource. It can also be used to update existing resources.

PUT = 'PUT'[source]

Updates a existing resource on a server. It can also be used to create a new resource.

PATCH = 'PATCH'[source]

Updates a existing resource on a server. It only updates the fields that are provided in the request body.

DELETE = 'DELETE'[source]

Deletes a resource from a server.

HEAD = 'HEAD'[source]

Retrieves metadata from a server. It only reads the headers and does not return the response body.

OPTIONS = 'OPTIONS'[source]

Provides information about the HTTP methods supported by a server. It can be used for Cross-Origin Resource Sharing (CORS) request.

class URL[source]

A dataclass containing the parsed URL components.

full_url: str[source]

The full URL.

base_url: str = ''[source]

The base URL, without query parameters.

secure: bool = False[source]

Whether the URL is secure (https/wss).

protocol: str = ''[source]

The protocol of the URL.

path: str = ''[source]

The path of the URL.

domain_with_port: str = ''[source]

The domain of the URL with port.

domain: str = ''[source]

The domain of the URL.

port: int | None = None[source]

The port of the URL.

params: dict[str, list[str]][source]

A dictionary of query parameters.

__post_init__() None[source]
class Proxy(
proxy: str | Dict[str, Any] | None = None,
*,
server: str | None = None,
username: str | None = None,
password: str | None = None,
)[source]

Универсальный класс для работы с прокси в двух форматах: 1. Строковый: ‘http://user:pass@host:port’ или ‘socks5://host:port’ 2. Playwright dict: {

‘server’: ‘http://host:port’, ‘username’: ‘user’, ‘password’: ‘pass’

}

as_dict() Dict[str, Any][source]

Возвращает прокси в формате Playwright

as_str(include_auth: bool = True) str[source]

Возвращает прокси в строковом формате. Если include_auth=False — без логина и пароля.

__repr__() str[source]
__bool__() bool[source]