openapi-python-client 0.18.0__tar.gz → 0.19.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/.gitignore +1 -0
  2. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/PKG-INFO +14 -4
  3. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/README.md +10 -0
  4. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/__init__.py +1 -1
  5. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/config.py +3 -0
  6. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/__init__.py +1 -1
  7. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/bodies.py +1 -1
  8. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/openapi.py +4 -3
  9. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/const.py +1 -2
  10. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/string.py +1 -2
  11. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/responses.py +3 -3
  12. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/client.py.jinja +8 -8
  13. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/endpoint_module.py.jinja +1 -1
  14. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/errors.py.jinja +3 -1
  15. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/pyproject.toml.jinja +1 -1
  16. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/utils.py +4 -1
  17. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/pyproject.toml +3 -3
  18. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/LICENSE +0 -0
  19. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/__main__.py +0 -0
  20. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/cli.py +0 -0
  21. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/errors.py +0 -0
  22. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/__init__.py +0 -0
  23. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/any.py +0 -0
  24. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/boolean.py +0 -0
  25. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/date.py +0 -0
  26. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/datetime.py +0 -0
  27. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/enum_property.py +0 -0
  28. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/file.py +0 -0
  29. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/float.py +0 -0
  30. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/int.py +0 -0
  31. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/list_property.py +0 -0
  32. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/model_property.py +0 -0
  33. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/none.py +0 -0
  34. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/property.py +0 -0
  35. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/protocol.py +0 -0
  36. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/schemas.py +0 -0
  37. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/parser/properties/union.py +0 -0
  38. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/py.typed +0 -0
  39. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/3.0.3.md +0 -0
  40. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/3.1.0.md +0 -0
  41. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/__init__.py +0 -0
  42. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/data_type.py +0 -0
  43. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/LICENSE +0 -0
  44. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/README.md +0 -0
  45. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/__init__.py +0 -0
  46. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/callback.py +0 -0
  47. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/components.py +0 -0
  48. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/contact.py +0 -0
  49. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py +0 -0
  50. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/encoding.py +0 -0
  51. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/example.py +0 -0
  52. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py +0 -0
  53. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/header.py +0 -0
  54. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/info.py +0 -0
  55. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/license.py +0 -0
  56. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/link.py +0 -0
  57. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/media_type.py +0 -0
  58. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py +0 -0
  59. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py +0 -0
  60. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/open_api.py +0 -0
  61. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/operation.py +0 -0
  62. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/parameter.py +0 -0
  63. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/path_item.py +0 -0
  64. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/paths.py +0 -0
  65. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/reference.py +0 -0
  66. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/request_body.py +0 -0
  67. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/response.py +0 -0
  68. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/responses.py +0 -0
  69. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/schema.py +0 -0
  70. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/security_requirement.py +0 -0
  71. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py +0 -0
  72. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/server.py +0 -0
  73. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py +0 -0
  74. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/tag.py +0 -0
  75. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/openapi_schema_pydantic/xml.py +0 -0
  76. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/schema/parameter_location.py +0 -0
  77. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/.gitignore.jinja +0 -0
  78. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/README.md.jinja +0 -0
  79. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/api_init.py.jinja +0 -0
  80. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/endpoint_init.py.jinja +0 -0
  81. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/endpoint_macros.py.jinja +0 -0
  82. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/helpers.jinja +0 -0
  83. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/int_enum.py.jinja +0 -0
  84. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/model.py.jinja +0 -0
  85. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/models_init.py.jinja +0 -0
  86. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/package_init.py.jinja +0 -0
  87. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/property_templates/any_property.py.jinja +0 -0
  88. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/property_templates/boolean_property.py.jinja +0 -0
  89. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/property_templates/date_property.py.jinja +0 -0
  90. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/property_templates/datetime_property.py.jinja +0 -0
  91. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/property_templates/enum_property.py.jinja +0 -0
  92. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/property_templates/file_property.py.jinja +0 -0
  93. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/property_templates/float_property.py.jinja +0 -0
  94. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/property_templates/helpers.jinja +0 -0
  95. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/property_templates/int_property.py.jinja +0 -0
  96. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/property_templates/list_property.py.jinja +0 -0
  97. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/property_templates/model_property.py.jinja +0 -0
  98. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/property_templates/property_macros.py.jinja +0 -0
  99. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/property_templates/union_property.py.jinja +0 -0
  100. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/pyproject_ruff.toml.jinja +0 -0
  101. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/setup.py.jinja +0 -0
  102. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/str_enum.py.jinja +0 -0
  103. {openapi_python_client-0.18.0 → openapi_python_client-0.19.1}/openapi_python_client/templates/types.py.jinja +0 -0
@@ -4,6 +4,7 @@ build/
4
4
  dist/
5
5
  *.egg-info/
6
6
  .pytest_cache/
7
+ .ruff_cache
7
8
 
8
9
  # macOS
9
10
  .DS_Store
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: openapi-python-client
3
- Version: 0.18.0
3
+ Version: 0.19.1
4
4
  Summary: Generate modern Python clients from OpenAPI
5
5
  Project-URL: repository, https://github.com/openapi-generators/openapi-python-client
6
6
  Author-email: Dylan Anthony <contact@dylananthony.com>
@@ -26,9 +26,9 @@ Requires-Dist: jinja2<4.0.0,>=3.0.0
26
26
  Requires-Dist: pydantic<3.0.0,>=2.1.1
27
27
  Requires-Dist: python-dateutil<3.0.0,>=2.8.1
28
28
  Requires-Dist: pyyaml<7.0,>=6.0
29
- Requires-Dist: ruff<0.3,>=0.2
29
+ Requires-Dist: ruff<0.4,>=0.2
30
30
  Requires-Dist: shellingham<2.0.0,>=1.3.2
31
- Requires-Dist: typer<0.10,>0.6
31
+ Requires-Dist: typer<0.12,>0.6
32
32
  Requires-Dist: typing-extensions<5.0.0,>=4.8.0
33
33
  Description-Content-Type: text/markdown
34
34
 
@@ -190,6 +190,16 @@ If this option results in conflicts, you will need to manually override class na
190
190
 
191
191
  By default, the timeout for retrieving the schema file via HTTP is 5 seconds. In case there is an error when retrieving the schema, you might try and increase this setting to a higher value.
192
192
 
193
+ ### content_type_overrides
194
+
195
+ Normally, `openapi-python-client` will skip any bodies or responses that it doesn't recognize the content type for.
196
+ This config tells the generator to treat a given content type like another.
197
+
198
+ ```yaml
199
+ content_type_overrides:
200
+ application/zip: application/octet-stream
201
+ ```
202
+
193
203
  [changelog.md]: CHANGELOG.md
194
204
  [poetry]: https://python-poetry.org/
195
205
  [PDM]: https://pdm-project.org/latest/
@@ -156,6 +156,16 @@ If this option results in conflicts, you will need to manually override class na
156
156
 
157
157
  By default, the timeout for retrieving the schema file via HTTP is 5 seconds. In case there is an error when retrieving the schema, you might try and increase this setting to a higher value.
158
158
 
159
+ ### content_type_overrides
160
+
161
+ Normally, `openapi-python-client` will skip any bodies or responses that it doesn't recognize the content type for.
162
+ This config tells the generator to treat a given content type like another.
163
+
164
+ ```yaml
165
+ content_type_overrides:
166
+ application/zip: application/octet-stream
167
+ ```
168
+
159
169
  [changelog.md]: CHANGELOG.md
160
170
  [poetry]: https://python-poetry.org/
161
171
  [PDM]: https://pdm-project.org/latest/
@@ -1,4 +1,4 @@
1
- """ Generate modern Python clients from OpenAPI """
1
+ """Generate modern Python clients from OpenAPI"""
2
2
 
3
3
  import json
4
4
  import mimetypes
@@ -35,6 +35,7 @@ class ConfigFile(BaseModel):
35
35
  """
36
36
 
37
37
  class_overrides: Optional[Dict[str, ClassOverride]] = None
38
+ content_type_overrides: Optional[Dict[str, str]] = None
38
39
  project_name_override: Optional[str] = None
39
40
  package_name_override: Optional[str] = None
40
41
  package_version_override: Optional[str] = None
@@ -70,6 +71,7 @@ class Config:
70
71
  http_timeout: int
71
72
  document_source: Union[Path, str]
72
73
  file_encoding: str
74
+ content_type_overrides: Dict[str, str]
73
75
 
74
76
  @staticmethod
75
77
  def from_sources(
@@ -91,6 +93,7 @@ class Config:
91
93
  config = Config(
92
94
  meta_type=meta_type,
93
95
  class_overrides=config_file.class_overrides or {},
96
+ content_type_overrides=config_file.content_type_overrides or {},
94
97
  project_name_override=config_file.project_name_override,
95
98
  package_name_override=config_file.package_name_override,
96
99
  package_version_override=config_file.package_version_override,
@@ -1,4 +1,4 @@
1
- """ Classes representing the data in the OpenAPI schema """
1
+ """Classes representing the data in the OpenAPI schema"""
2
2
 
3
3
  __all__ = ["GeneratorData", "import_string_from_class"]
4
4
 
@@ -56,7 +56,7 @@ def body_from_data(
56
56
  prefix_type_names = len(body_content) > 1
57
57
 
58
58
  for content_type, media_type in body_content.items():
59
- simplified_content_type = get_content_type(content_type)
59
+ simplified_content_type = get_content_type(content_type, config)
60
60
  if simplified_content_type is None:
61
61
  bodies.append(
62
62
  ParseError(
@@ -26,7 +26,7 @@ from .properties import (
26
26
  from .properties.schemas import parameter_from_reference
27
27
  from .responses import Response, response_from_data
28
28
 
29
- _PATH_PARAM_REGEX = re.compile("{([a-zA-Z_][a-zA-Z0-9_]*)}")
29
+ _PATH_PARAM_REGEX = re.compile("{([a-zA-Z_-][a-zA-Z0-9_-]*)}")
30
30
 
31
31
 
32
32
  def import_string_from_class(class_: Class, prefix: str = "") -> str:
@@ -114,8 +114,7 @@ class RequestBodyParser(Protocol):
114
114
 
115
115
  def __call__(
116
116
  self, *, body: oai.RequestBody, schemas: Schemas, parent_name: str, config: Config
117
- ) -> Tuple[Union[Property, PropertyError, None], Schemas]:
118
- ... # pragma: no cover
117
+ ) -> Tuple[Union[Property, PropertyError, None], Schemas]: ... # pragma: no cover
119
118
 
120
119
 
121
120
  @dataclass
@@ -380,6 +379,8 @@ class Endpoint:
380
379
  return ParseError(
381
380
  detail=f"Incorrect path templating for {endpoint.path} (Path parameters do not match with path)",
382
381
  )
382
+ for parameter in endpoint.path_parameters:
383
+ endpoint.path = endpoint.path.replace(f"{{{parameter.name}}}", f"{{{parameter.python_name}}}")
383
384
  return endpoint
384
385
 
385
386
  @staticmethod
@@ -78,8 +78,7 @@ class ConstProperty(PropertyProtocol):
78
78
 
79
79
  @staticmethod
80
80
  @overload
81
- def _convert_value(value: Any) -> Value:
82
- ... # pragma: no cover
81
+ def _convert_value(value: Any) -> Value: ... # pragma: no cover
83
82
 
84
83
  @staticmethod
85
84
  def _convert_value(value: Any) -> Value | None:
@@ -61,8 +61,7 @@ class StringProperty(PropertyProtocol):
61
61
 
62
62
  @classmethod
63
63
  @overload
64
- def convert_value(cls, value: Any) -> Value:
65
- ... # pragma: no cover
64
+ def convert_value(cls, value: Any) -> Value: ... # pragma: no cover
66
65
 
67
66
  @classmethod
68
67
  def convert_value(cls, value: Any) -> Value | None:
@@ -37,8 +37,8 @@ class Response:
37
37
  data: Union[oai.Response, oai.Reference] # Original data which created this response, useful for custom templates
38
38
 
39
39
 
40
- def _source_by_content_type(content_type: str) -> Optional[_ResponseSource]:
41
- parsed_content_type = utils.get_content_type(content_type)
40
+ def _source_by_content_type(content_type: str, config: Config) -> Optional[_ResponseSource]:
41
+ parsed_content_type = utils.get_content_type(content_type, config)
42
42
  if parsed_content_type is None:
43
43
  return None
44
44
 
@@ -114,7 +114,7 @@ def response_from_data(
114
114
  )
115
115
 
116
116
  for content_type, media_type in content.items():
117
- source = _source_by_content_type(content_type)
117
+ source = _source_by_content_type(content_type, config)
118
118
  if source is not None:
119
119
  schema_data = media_type.media_type_schema
120
120
  break
@@ -37,13 +37,13 @@ class Client:
37
37
  """
38
38
  {% macro attributes() %}
39
39
  raise_on_unexpected_status: bool = field(default=False, kw_only=True)
40
- _base_url: str
41
- _cookies: Dict[str, str] = field(factory=dict, kw_only=True)
42
- _headers: Dict[str, str] = field(factory=dict, kw_only=True)
43
- _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True)
44
- _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True)
45
- _follow_redirects: bool = field(default=False, kw_only=True)
46
- _httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True)
40
+ _base_url: str = field(alias="base_url")
41
+ _cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
42
+ _headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
43
+ _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
44
+ _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
45
+ _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
46
+ _httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
47
47
  _client: Optional[httpx.Client] = field(default=None, init=False)
48
48
  _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
49
49
  {% endmacro %}{{ attributes() }}
@@ -163,4 +163,4 @@ class AuthenticatedClient:
163
163
  auth_header_name: str = "Authorization"
164
164
 
165
165
  {{ builders("AuthenticatedClient") }}
166
- {{ httpx_stuff("AuthenticatedClient", "self._headers[self.auth_header_name] = f\"{self.prefix} {self.token}\" if self.prefix else self.token") }}
166
+ {{ httpx_stuff("AuthenticatedClient", "self._headers[self.auth_header_name] = f\"{self.prefix} {self.token}\" if self.prefix else self.token") }}
@@ -31,7 +31,7 @@ def _get_kwargs(
31
31
  {% if endpoint.path_parameters %}
32
32
  "url": "{{ endpoint.path }}".format(
33
33
  {%- for parameter in endpoint.path_parameters -%}
34
- {{parameter.name}}={{parameter.python_name}},
34
+ {{parameter.python_name}}={{parameter.python_name}},
35
35
  {%- endfor -%}
36
36
  ),
37
37
  {% else %}
@@ -7,6 +7,8 @@ class UnexpectedStatus(Exception):
7
7
  self.status_code = status_code
8
8
  self.content = content
9
9
 
10
- super().__init__(f"Unexpected status code: {status_code}")
10
+ super().__init__(
11
+ f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
12
+ )
11
13
 
12
14
  __all__ = ["UnexpectedStatus"]
@@ -25,7 +25,7 @@ dependencies = [
25
25
  ]
26
26
 
27
27
  [tool.pdm]
28
- package-type = "library"
28
+ distribution = true
29
29
  {% endif %}
30
30
  {% if poetry %}
31
31
 
@@ -6,6 +6,8 @@ from email.message import Message
6
6
  from keyword import iskeyword
7
7
  from typing import Any
8
8
 
9
+ from .config import Config
10
+
9
11
  DELIMITERS = r"\. _-"
10
12
 
11
13
 
@@ -105,10 +107,11 @@ def remove_string_escapes(value: str) -> str:
105
107
  return value.replace('"', r"\"")
106
108
 
107
109
 
108
- def get_content_type(content_type: str) -> str | None:
110
+ def get_content_type(content_type: str, config: Config) -> str | None:
109
111
  """
110
112
  Given a string representing a content type with optional parameters, returns the content type only
111
113
  """
114
+ content_type = config.content_type_overrides.get(content_type, content_type)
112
115
  message = Message()
113
116
  message.add_header("Content-Type", content_type)
114
117
 
@@ -6,7 +6,7 @@ license = { text = "MIT" }
6
6
  requires-python = ">=3.8,<4.0"
7
7
  dependencies = [
8
8
  "jinja2>=3.0.0,<4.0.0",
9
- "typer>0.6,<0.10",
9
+ "typer>0.6,<0.12",
10
10
  "colorama>=0.4.3; sys_platform == \"win32\"",
11
11
  "shellingham>=1.3.2,<2.0.0",
12
12
  "pydantic>=2.1.1,<3.0.0",
@@ -14,11 +14,11 @@ dependencies = [
14
14
  "python-dateutil>=2.8.1,<3.0.0",
15
15
  "httpx>=0.20.0,<0.28.0",
16
16
  "PyYAML>=6.0,<7.0",
17
- "ruff>=0.2,<0.3",
17
+ "ruff>=0.2,<0.4",
18
18
  "typing-extensions>=4.8.0,<5.0.0",
19
19
  ]
20
20
  name = "openapi-python-client"
21
- version = "0.18.0"
21
+ version = "0.19.1"
22
22
  description = "Generate modern Python clients from OpenAPI"
23
23
  keywords = [
24
24
  "OpenAPI",