File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -524,7 +524,7 @@ def import_model_from_zip(
524
524
project : str or dict
525
525
The name or id of the model project, or a dictionary
526
526
representation of the project.
527
- file : bytes
527
+ file : bytes or file-like object
528
528
The ZIP file containing the model and contents.
529
529
description : str
530
530
The description of the model.
@@ -551,9 +551,14 @@ def import_model_from_zip(
551
551
}
552
552
params = "&" .join ("{}={}" .format (k , v ) for k , v in params .items ())
553
553
554
+ if not isinstance (file , bytes ):
555
+ if file .seekable ():
556
+ file .seek (0 )
557
+ file = file .read ()
558
+
554
559
r = cls .post (
555
560
"/models#octetStream" ,
556
- data = file . read () ,
561
+ data = file ,
557
562
params = params ,
558
563
headers = {"Content-Type" : "application/octet-stream" },
559
564
)
You can’t perform that action at this time.
0 commit comments