pyoaev.backends.backend ======================= .. py:module:: pyoaev.backends.backend Module Contents --------------- .. py:class:: Auth(token: str) .. py:attribute:: token .. py:class:: TokenAuth(token: str) Bases: :py:obj:`Auth`, :py:obj:`requests.auth.AuthBase` Base class that all auth implementations derive from .. py:class:: SendData .. py:attribute:: content_type :type: str .. py:attribute:: data :type: Optional[Union[Dict[str, Any], requests_toolbelt.multipart.encoder.MultipartEncoder]] :value: None .. py:attribute:: json :type: Optional[Union[Dict[str, Any], bytes]] :value: None .. py:class:: RequestsResponse(response: requests.Response) Bases: :py:obj:`pyoaev.backends.protocol.BackendResponse` Base class for protocol classes. Protocol classes are defined as:: class Proto(Protocol): def meth(self) -> int: ... Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing). For example:: class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:: class GenProto[T](Protocol): def meth(self) -> T: ... .. py:attribute:: _response :type: requests.Response .. py:property:: response :type: requests.Response .. py:property:: status_code :type: int .. py:property:: headers :type: requests.structures.CaseInsensitiveDict[str] .. py:property:: content :type: bytes .. py:property:: reason :type: str .. py:method:: json() -> Any .. py:class:: RequestsBackend(session: Optional[requests.Session] = None) Bases: :py:obj:`pyoaev.backends.protocol.Backend` Base class for protocol classes. Protocol classes are defined as:: class Proto(Protocol): def meth(self) -> int: ... Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing). For example:: class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:: class GenProto[T](Protocol): def meth(self) -> T: ... .. py:attribute:: _client :type: requests.Session .. py:property:: client :type: requests.Session .. py:method:: prepare_send_data(files: Optional[Dict[str, Any]] = None, post_data: Optional[Union[Dict[str, Any], bytes, BinaryIO]] = None, raw: bool = False) -> SendData :staticmethod: .. py:method:: http_request(method: str, url: str, json: Optional[Union[Dict[str, Any], bytes]] = None, data: Optional[Union[Dict[str, Any], requests_toolbelt.multipart.encoder.MultipartEncoder]] = None, params: Optional[Any] = None, timeout: Optional[float] = None, verify: Optional[Union[bool, str]] = True, stream: Optional[bool] = False, **kwargs: Any) -> RequestsResponse Make HTTP request Args: method: The HTTP method to call ('get', 'post', 'put', 'delete', etc.) url: The full URL data: The data to send to the server in the body of the request json: Data to send in the body in json by default timeout: The timeout, in seconds, for the request verify: Whether SSL certificates should be validated. If the value is a string, it is the path to a CA file used for certificate validation. stream: Whether the data should be streamed Returns: A requests Response object.