@@ -89,8 +89,7 @@ def run_simulation(self, simulationType = "regular", agent=1):
8989 else :
9090 return resp_json ['error_msg' ]
9191
92-
93- def create_model (self , file_dir , comment = "Upload through Python API" , simulationType = "" , agent = 0 ):
92+ def create_run_model (self , file_dir , comment = "Upload through Python API" , simulationType = "regular" , agent = 1 ):
9493 url = SimulationJob .BASE_URL + 'CreateModel_API'
9594 payload = {
9695 'user_api_key' : self ._userKey ,
@@ -99,6 +98,28 @@ def create_model(self, file_dir, comment = "Upload through Python API", simulati
9998 'simulation_type' : simulationType ,
10099 'agents' : agent
101100 }
101+ files = {
102+ 'file' : open (file_dir , 'rb' )
103+ }
104+
105+ r = requests .post (url , data = payload , files = files )
106+ resp_json = r .json ()
107+
108+ if (resp_json ['status' ] == 'success' ):
109+ self ._trackToken = resp_json ['tracking' ]
110+ return resp_json ['status' ]
111+ else :
112+ return resp_json ['error_msg' ]
113+
114+ def create_model (self , file_dir , comment = "Upload through Python API" ):
115+ url = SimulationJob .BASE_URL + 'CreateModel_API'
116+ payload = {
117+ 'user_api_key' : self ._userKey ,
118+ 'folder_api_key' : self ._modelKey ,
119+ 'comment' : comment ,
120+ 'simulation_type' : '' ,
121+ 'agents' : 1
122+ }
102123
103124 files = {
104125 'file' : open (file_dir , 'rb' )
0 commit comments