Skip to content
File

Blob: src/pyodide/internal/workers-api/src/workers/__init__.py

python69 lines
1# Python SDK for workerd now lives in https://github.com/cloudflare/workers-py
2# All new features should be implemented there and this module is only kept for backward compatibility
3 
4from ._workers import (
5 Blob,
6 BlobEnding,
7 BlobValue,
8 Body,
9 Context,
10 DurableObject,
11 FetchKwargs,
12 FetchResponse,
13 File,
14 FormData,
15 FormDataValue,
16 Headers,
17 JSBody,
18 Request,
19 RequestInitCfProperties,
20 Response,
21 WorkerEntrypoint,
22 WorkflowEntrypoint,
23 fetch,
24 handler,
25 import_from_javascript,
26 patch_env,
27 python_from_rpc,
28 python_to_rpc,
29)
30 
31__all__ = [
32 "Blob",
33 "BlobEnding",
34 "BlobValue",
35 "Body",
36 "Context",
37 "DurableObject",
38 "FetchKwargs",
39 "FetchResponse",
40 "File",
41 "FormData",
42 "FormDataValue",
43 "Headers",
44 "JSBody",
45 "Request",
46 "RequestInitCfProperties",
47 "Response",
48 "WorkerEntrypoint",
49 "WorkflowEntrypoint",
50 "env",
51 "fetch",
52 "handler",
53 "import_from_javascript",
54 "patch_env",
55 "python_from_rpc",
56 "python_to_rpc",
57 "waitUntil",
58]
59 
60 
61def __getattr__(key):
62 if key == "env":
63 cloudflare_workers = import_from_javascript("cloudflare:workers")
64 return cloudflare_workers.env
65 if key == "waitUntil":
66 cloudflare_workers = import_from_javascript("cloudflare:workers")
67 return cloudflare_workers.waitUntil
68 raise AttributeError(f"module {__name__!r} has no attribute {key!r}")