File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
modules/swagger-codegen/src/main
java/io/swagger/codegen/languages Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
2525 public static final String PACKAGE_URL = "packageUrl" ;
2626 public static final String DEFAULT_LIBRARY = "urllib3" ;
2727
28+ public static final String WRITE_BINARY_OPTION = "writeBinary" ;
29+
2830 protected String packageName ; // e.g. petstore_api
2931 protected String packageVersion ;
3032 protected String projectName ; // for setup.py, e.g. petstore-api
@@ -174,6 +176,11 @@ public void processOpts() {
174176 setPackageVersion ("1.0.0" );
175177 }
176178
179+ if (additionalProperties .containsKey (WRITE_BINARY_OPTION )) {
180+ boolean optionValue = Boolean .parseBoolean (String .valueOf (additionalProperties .get (WRITE_BINARY_OPTION )));
181+ additionalProperties .put (WRITE_BINARY_OPTION , optionValue );
182+ }
183+
177184 additionalProperties .put (CodegenConstants .PROJECT_NAME , projectName );
178185 additionalProperties .put (CodegenConstants .PACKAGE_NAME , packageName );
179186 additionalProperties .put (CodegenConstants .PACKAGE_VERSION , packageVersion );
Original file line number Diff line number Diff line change @@ -540,7 +540,7 @@ class ApiClient(object):
540540 content_disposition).group(1)
541541 path = os.path.join(os.path.dirname(path), filename)
542542
543- with open(path, "w") as f:
543+ with open(path, { {^writeBinary } } "w"{ {/writeBinary } } { {#writeBinary } }"wb" { {/writeBinary } } ) as f:
544544 f.write(response.data)
545545
546546 return path
You can’t perform that action at this time.
0 commit comments