Request, WebhookRequest and Response protocols¶
openapi_core.protocols
¶
OpenAPI core protocols
Attributes¶
Classes¶
BaseRequest
¶
Bases: Protocol
Source code in openapi_core/protocols.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
Request
¶
Bases: BaseRequest, Protocol
Request protocol.
| ATTRIBUTE | DESCRIPTION |
|---|---|
host_url |
Url with scheme and host. For example: https://localhost:8000
TYPE:
|
path |
Request path.
TYPE:
|
full_url_pattern |
The matched url with scheme, host and path pattern. For example: https://localhost:8000/api/v1/pets https://localhost:8000/api/v1/pets/{pet_id}
TYPE:
|
method |
The request method, as lowercase string.
TYPE:
|
parameters |
A RequestParameters object. Needs to support path attribute setter to write resolved path parameters.
TYPE:
|
content_type |
The content type with parameters (e.g., charset, boundary, etc.) and always lowercase.
TYPE:
|
body |
The request body, as bytes (None if not provided).
TYPE:
|
Source code in openapi_core/protocols.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
WebhookRequest
¶
Bases: BaseRequest, Protocol
Webhook request protocol.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Webhook name.
TYPE:
|
method |
The request method, as lowercase string.
TYPE:
|
parameters |
A RequestParameters object. Needs to support path attribute setter to write resolved path parameters.
TYPE:
|
content_type |
The content type with parameters (e.g., charset, boundary, etc.) and always lowercase.
TYPE:
|
body |
The request body, as bytes (None if not provided).
TYPE:
|
Source code in openapi_core/protocols.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
SupportsPathPattern
¶
Bases: Protocol
Supports path_pattern protocol.
You also need to provide path variables in RequestParameters.
| ATTRIBUTE | DESCRIPTION |
|---|---|
path_pattern |
The matched path pattern. For example: /api/v1/pets/{pet_id}
TYPE:
|
Source code in openapi_core/protocols.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
Response
¶
Bases: Protocol
Response protocol.
| ATTRIBUTE | DESCRIPTION |
|---|---|
status_code |
The status code as integer.
TYPE:
|
headers |
Response headers as Headers.
TYPE:
|
content_type |
The content type with parameters and always lowercase.
TYPE:
|
data |
The response body, as bytes (None if not provided).
TYPE:
|
Source code in openapi_core/protocols.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |