You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The chunk size to use (if any) when processing a response bytes stream within `iter_bytes` or `aiter_bytes` results in: `for chunk in response.iter_bytes(chunk_size=<default_bytes_stream_chunk_size>):`
When enabled, the python generator will not run Black formatting in the generated code. Black is slow so this can potentially speed up code generation quite a bit.
By default, the generator generates a client that times out after 60 seconds. You can customize this value by providing a different number or setting to `infinity` to get rid of timeouts.
Whether or not to generate TypedDicts instead of Pydantic Models for file upload request objects. Note that this flag was only introduced due to an oversight in the `use_typeddict_requests` flag implementation; it should be removed in the future.
169
168
</ParamField>
170
169
170
+
### Extension Headers
171
+
172
+
The Python SDK generator supports setting extension headers via the `x-fern-sdk-variables` OpenAPI extension. This allows you to define variables that will be passed to the SDK constructor and injected into API paths.
173
+
174
+
For example, to have a `project_id` variable injected into paths:
175
+
176
+
```yaml
177
+
# OpenAPI spec
178
+
x-fern-sdk-variables:
179
+
project_id:
180
+
type: string
181
+
description: The ID of the project
182
+
pattern: "^proj_[a-zA-Z0-9]+$"
183
+
184
+
paths:
185
+
/v1/connect/{project_id}/accounts:
186
+
parameters:
187
+
- name: project_id
188
+
in: path
189
+
required: true
190
+
schema:
191
+
type: string
192
+
pattern: "^proj_[a-zA-Z0-9]+$"
193
+
x-fern-sdk-variable: project_id
194
+
```
195
+
196
+
The variable will be available in the SDK client constructor:
197
+
198
+
```python
199
+
from my_sdk import Client
200
+
201
+
client = Client(
202
+
project_id="proj_123" # Will be injected into paths
203
+
)
204
+
```
205
+
171
206
### client
172
-
Configuration for the generated client class and file structure.
173
207
174
-
```yaml
175
-
config:
176
-
client:
177
-
filename: "my_client.py"
178
-
class_name: "MyClient"
179
-
exported_filename: "my_client.py"
180
-
exported_class_name: "MyClient"
181
-
```
208
+
Configuration for the generated client class and file structure.
0 commit comments