mokr.network.http ================= .. py:module:: mokr.network.http Classes ------- .. autoapisummary:: mokr.network.http.HttpDomain Module Contents --------------- .. py:class:: HttpDomain(page: mokr.browser.page.Page, sync_cookies: Literal['both', 'http', 'page', 'none'] = 'both', **httpx_client_kwargs) Client to handle sending requests outside of the browser, while syncing state between itself and the parent `mokr.browser.Page`. This client uses `httpx` so requests can be made with HTTP2. :param page: Parent `mokr.browser.Page` that this will sync with. :type page: Page :param sync_cookies: Whether to sync cookies between this client and the parent `mokr.browser.Page` before/after each request and response. Defaults to "both". :type sync_cookies: Literal["both", "http", "page", "none"], optional .. py:method:: send(url: str, method: mokr.constants.HTTP_METHODS = 'GET', params: dict | None = None, headers: dict | None = None, data: dict | None = None, json: dict | None = None, **httpx_request_kwargs) -> mokr.network.response.Response :async: Send an HTTP request. :param url: The url to request. :type url: str :param method: HTTP method. Defaults to "GET". :type method: Literal[str], optional :param params: Parameters to encode in the URL before sending. Defaults to None (omitted). :type params: dict | None, optional :param headers: Additional headers to send with this request beyond what was set when the client was created. Defaults to None (omitted). :type headers: dict | None, optional :param data: Data payload to deliver with request (form-encoded data). Only for "PUT", "POST", and "PATCH". Defaults to None (omitted). :type data: dict | None, optional :param json: Data payload to deliver with request (JSON-encoded data). Only for "PUT", "POST", and "PATCH". Defaults to None (omitted). :type json: dict | None, optional :raises ValueError: Raised if invalid HTTP method given or `data` or `json` arguments given with incompatible methods. :returns: A `mokr.network.Response` created from the `httpx.Response`. All redirects will also be created, and original requests and responses will be accessible from the `mokr.network` objects. :rtype: Response