pyoaev.backends.backend
Module Contents
- class pyoaev.backends.backend.TokenAuth(token: str)
Bases:
Auth,requests.auth.AuthBaseBase class that all auth implementations derive from
- class pyoaev.backends.backend.SendData
- content_type: str
- data: Dict[str, Any] | requests_toolbelt.multipart.encoder.MultipartEncoder | None = None
- json: Dict[str, Any] | bytes | None = None
- class pyoaev.backends.backend.RequestsResponse(response: requests.Response)
Bases:
pyoaev.backends.protocol.BackendResponseBase 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: ...
- _response: requests.Response
- property response: requests.Response
- property status_code: int
- property headers: requests.structures.CaseInsensitiveDict[str]
- property content: bytes
- property reason: str
- json() Any
- class pyoaev.backends.backend.RequestsBackend(session: requests.Session | None = None)
Bases:
pyoaev.backends.protocol.BackendBase 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: ...
- _client: requests.Session
- property client: requests.Session
- static prepare_send_data(files: Dict[str, Any] | None = None, post_data: Dict[str, Any] | bytes | BinaryIO | None = None, raw: bool = False) SendData
- http_request(method: str, url: str, json: Dict[str, Any] | bytes | None = None, data: Dict[str, Any] | requests_toolbelt.multipart.encoder.MultipartEncoder | None = None, params: Any | None = None, timeout: float | None = None, verify: bool | str | None = True, stream: bool | None = 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.