← Về thư mục
skills/protocolsio-integration/scripts/_common.py
- SafetyError · class · L63-L64 — class SafetyError(ValueError)
- ApiError · class · L67-L79 — class ApiError(RuntimeError)
- init · method · L70-L79 — def init( self, message: str, *, http_status: int | None = None, api_status: int | str | None = None, ) -> None
- HttpResult · class · L83-L90 — class HttpResult
- NoRedirectHandler · class · L93-L106 — class NoRedirectHandler(urllib.request.HTTPRedirectHandler)
- redirect_request · method · L96-L106 — def redirect_request( # type: ignore[override] self, req: urllib.request.Request, fp: Any, code: int, msg: str, headers: Mapping[str, str], newurl: str, ) -> None
- _reject_constant · function · L109-L110 — def _reject_constant(value: str) -> None
- _unique_object · function · L113-L119 — def _unique_object(pairs: list[tuple[str, Any]]) -> dict[str, Any]
- parse_json_bytes · function · L122-L138 — def parse_json_bytes(raw: bytes, *, source: str = "response") -> Any
- _path_inside_cwd · function · L141-L166 — def _path_inside_cwd(raw_path: str, *, must_exist: bool) -> Path
- safe_input_path · function · L169-L185 — def safe_input_path( raw_path: str, *, suffixes: Sequence[str], max_bytes: int, ) -> Path
- load_local_json · function · L188-L194 — def load_local_json( raw_path: str, *, max_bytes: int = MAX_LOCAL_JSON_BYTES, ) -> Any
- safe_output_path · function · L197-L208 — def safe_output_path(raw_path: str, *, suffix: str) -> Path
- write_private_bytes · function · L211-L227 — def write_private_bytes(path: Path, data: bytes) -> None
- clean_text · function · L230-L236 — def clean_text(value: str, *, max_chars: int = MAX_REMOTE_STRING_CHARS) -> str
- _sensitive_key · function · L239-L241 — def _sensitive_key(key: str) -> bool
- sanitize_untrusted · function · L244-L291 — def sanitize_untrusted( value: Any, *, depth: int = 0, max_string_chars: int = MAX_REMOTE_STRING_CHARS, max_items: int = MAX_REMOTE_COLLECTION_ITEMS, ) -> Any
- emit_json · function · L294-L302 — def emit_json(payload: Any, *, stream: Any = None) -> None
- emit_error · function · L305-L317 — def emit_error(error: Exception) -> int
- validate_timeout · function · L320-L329 — def validate_timeout(value: float) -> float
- validate_retries · function · L332-L335 — def validate_retries(value: int) -> int
- is_official_host · function · L338-L342 — def is_official_host(host: str, *, allow_tenant: bool = False) -> bool
- validate_origin · function · L345-L367 — def validate_origin(raw_origin: str, *, allow_tenant: bool = False) -> str
- validate_remote_url · function · L370-L396 — def validate_remote_url( raw_url: str, *, allow_tenant: bool = False, allowed_paths: Sequence[str] = ("/api/", "/view/"), ) -> str
- build_url · function · L399-L410 — def build_url( origin: str, path: str, params: Mapping[str, Any] | None = None, ) -> str
- validate_protocol_identifier · function · L413-L419 — def validate_protocol_identifier(value: str) -> str
- encode_protocol_identifier · function · L422-L426 — def encode_protocol_identifier(value: str) -> str
- validate_guid · function · L429-L432 — def validate_guid(value: str) -> str
- validate_nonnegative_integer · function · L435-L441 — def validate_nonnegative_integer(value: str, *, name: str, maximum: int) -> int
- credential_status · function · L444-L459 — def credential_status( environ: Mapping[str, str] | None = None, ) -> dict[str, Any]
- _bounded_read · function · L462-L484 — def _bounded_read(response: Any, max_bytes: int) -> bytes
- _retry_delay · function · L487-L496 — def _retry_delay(headers: Mapping[str, str], attempt: int) -> float
- _api_error_from_body · function · L499-L511 — def _api_error_from_body(status: int, body: bytes) -> ApiError
- request_bytes · function · L514-L601 — def request_bytes( url: str, *, token: str | None, accept: str, timeout: float = DEFAULT_TIMEOUT_SECONDS, retries: int = 1, max_bytes: int = MAX_JSON_RESPONSE_BYTES, opener: Any | None = None, sleep: Callable[[float], None] = time.sleep, ) -> HttpResult
- require_api_success · function · L604-L613 — def require_api_success(payload: Any) -> Mapping[str, Any]