Module spin_sdk.spin_http
Module for sending outbound HTTP requests
Expand source code
"""Module for sending outbound HTTP requests"""
from dataclasses import dataclass
from collections.abc import Mapping
from typing import Optional
@dataclass
class Request:
"""An HTTP request"""
method: str
uri: str
headers: Mapping[str, str]
body: Optional[bytes]
@dataclass
class Response:
"""An HTTP response"""
status: int
headers: Mapping[str, str]
body: Optional[bytes]
def http_send(request: Request) -> Response:
"""Send an HTTP request and return a response or raise an error"""
raise NotImplementedError
Functions
def http_send(request: Request) ‑> Response
-
Send an HTTP request and return a response or raise an error
Expand source code
def http_send(request: Request) -> Response: """Send an HTTP request and return a response or raise an error""" raise NotImplementedError
Classes
class Request (method: str, uri: str, headers: collections.abc.Mapping[str, str], body: Optional[bytes])
-
An HTTP request
Expand source code
@dataclass class Request: """An HTTP request""" method: str uri: str headers: Mapping[str, str] body: Optional[bytes]
Class variables
var body : Optional[bytes]
var headers : collections.abc.Mapping[str, str]
var method : str
var uri : str
class Response (status: int, headers: collections.abc.Mapping[str, str], body: Optional[bytes])
-
An HTTP response
Expand source code
@dataclass class Response: """An HTTP response""" status: int headers: Mapping[str, str] body: Optional[bytes]
Class variables
var body : Optional[bytes]
var headers : collections.abc.Mapping[str, str]
var status : int