requests

Modulefastly-compute 0.1.3

fastly_compute::requests

A requests-compatible HTTP client for Fastly Compute.

This module provides a familiar requests-like API while leveraging Fastly's backend architecture and WIT bindings for optimal performance.

Compatibility Notes: Most parameters are compatible with the standard requests library. Fastly-specific parameters (fastlytimeout, fastlybackend) will cause TypeErrors if used with the standard requests library. Use the standard timeout parameter for cross-platform compatibility.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import fastly_compute.requests as requests
from fastly_compute.requests import TimeoutConfig
# Static backend (pre-configured)
response = requests.get("/api/users", fastly_backend="api-backend")
# or, providing full URL (will still use backend configuration)
response = requests.get("https://example.com/api/users", fastly_backend="api-backend")
# Dynamic backend (looks like normal requests usage)
response = requests.get("https://http-me.fastly.dev/get")
# POST with JSON
response = requests.post("https://http-me.fastly.dev/post",
json={"key": "value"})
# Granular timeout control (Fastly-specific)
timeout_config = TimeoutConfig(
connect=5.0, # 5s to establish connection
first_byte=30.0, # 30s to receive first byte
between_bytes=2.0 # 2s max between bytes
)
response = requests.get(
"https://api.example.com/data",
fastly_timeout=timeout_config
)

Modules

backendBackend resolution logic for fastly_compute.requests.
exceptionsExceptions for fastly_compute.requests - compatible with requests library.
responseA requests-compatible response object for Fastly Compute.
timeoutTimeout configuration for Fastly Compute requests.

Structs

RequestKwargsCommon keyword arguments for all request methods.

Functions

deleteSend a DELETE request.
getSend a GET request.
headSend a HEAD request.
optionsSend an OPTIONS request.
patchSend a PATCH request.
postSend a POST request.
putSend a PUT request.
requestSend an HTTP request.