@@ -180,8 +180,8 @@ def delete_event(self, event_id):
180
180
181
181
## Below are helper functions
182
182
183
- def aset_user (self , uid , properties = {}, eventTime = None ):
184
- eventTime = now_if_none (eventTime )
183
+ def aset_user (self , uid , properties = {}, event_time = None ):
184
+ event_time = now_if_none (event_time )
185
185
186
186
"""set properties of an user"""
187
187
return self .acreate_event ({
@@ -190,15 +190,15 @@ def aset_user(self, uid, properties={}, eventTime=None):
190
190
"entityId" : uid ,
191
191
"properties" : properties ,
192
192
"appId" : self .app_id ,
193
- "eventTime" : eventTime .isoformat (),
193
+ "eventTime" : event_time .isoformat (),
194
194
})
195
195
196
- def set_user (self , uid , properties = {}, eventTime = None ):
197
- return self .aset_user (uid , properties , eventTime ).get_response ()
196
+ def set_user (self , uid , properties = {}, event_time = None ):
197
+ return self .aset_user (uid , properties , event_time ).get_response ()
198
198
199
- def aunset_user (self , uid , properties , eventTime = None ):
199
+ def aunset_user (self , uid , properties , event_time = None ):
200
200
"""unset properties of an user"""
201
- eventTime = now_if_none (eventTime )
201
+ event_time = now_if_none (event_time )
202
202
203
203
# check properties={}, it cannot be empty
204
204
return self .acreate_event ({
@@ -207,71 +207,71 @@ def aunset_user(self, uid, properties, eventTime=None):
207
207
"entityId" : uid ,
208
208
"properties" : properties ,
209
209
"appId" : self .app_id ,
210
- "eventTime" : eventTime .isoformat (),
210
+ "eventTime" : event_time .isoformat (),
211
211
})
212
212
213
- def unset_user (self , uid , properties , eventTime = None ):
214
- return self .aunset_user (uid , properties , eventTime ).get_response ()
213
+ def unset_user (self , uid , properties , event_time = None ):
214
+ return self .aunset_user (uid , properties , event_time ).get_response ()
215
215
216
- def adelete_user (self , uid , eventTime = None ):
216
+ def adelete_user (self , uid , event_time = None ):
217
217
"""set properties of an user"""
218
- eventTime = now_if_none (eventTime )
218
+ event_time = now_if_none (event_time )
219
219
return self .acreate_event ({
220
220
"event" : "$delete" ,
221
221
"entityType" : "pio_user" ,
222
222
"entityId" : uid ,
223
223
"appId" : self .app_id ,
224
- "eventTime" : eventTime .isoformat (),
224
+ "eventTime" : event_time .isoformat (),
225
225
})
226
226
227
- def delete_user (self , uid , eventTime = None ):
228
- return self .adelete_user (uid , eventTime ).get_response ()
227
+ def delete_user (self , uid , event_time = None ):
228
+ return self .adelete_user (uid , event_time ).get_response ()
229
229
230
- def aset_item (self , iid , properties = {}, eventTime = None ):
231
- eventTime = now_if_none (eventTime )
230
+ def aset_item (self , iid , properties = {}, event_time = None ):
231
+ event_time = now_if_none (event_time )
232
232
return self .acreate_event ({
233
233
"event" : "$set" ,
234
234
"entityType" : "pio_item" ,
235
235
"entityId" : iid ,
236
236
"properties" : properties ,
237
237
"appId" : self .app_id ,
238
- "eventTime" : eventTime .isoformat (),
238
+ "eventTime" : event_time .isoformat (),
239
239
})
240
240
241
- def set_item (self , iid , properties = {}, eventTime = None ):
241
+ def set_item (self , iid , properties = {}, event_time = None ):
242
242
return self .aset_item (iid , properties ).get_response ()
243
243
244
- def aunset_item (self , iid , properties = {}, eventTime = None ):
245
- eventTime = now_if_none (eventTime )
244
+ def aunset_item (self , iid , properties = {}, event_time = None ):
245
+ event_time = now_if_none (event_time )
246
246
return self .acreate_event ({
247
247
"event" : "$unset" ,
248
248
"entityType" : "pio_item" ,
249
249
"entityId" : iid ,
250
250
"properties" : properties ,
251
251
"appId" : self .app_id ,
252
- "eventTime" : eventTime .isoformat (),
252
+ "eventTime" : event_time .isoformat (),
253
253
})
254
254
255
- def unset_item (self , iid , properties = {}, eventTime = None ):
256
- return self .aunset_item (iid , properties , eventTime ).get_response ()
255
+ def unset_item (self , iid , properties = {}, event_time = None ):
256
+ return self .aunset_item (iid , properties , event_time ).get_response ()
257
257
258
- def adelete_item (self , iid , eventTime = None ):
258
+ def adelete_item (self , iid , event_time = None ):
259
259
"""set properties of an user"""
260
- eventTime = now_if_none (eventTime )
260
+ event_time = now_if_none (event_time )
261
261
return self .acreate_event ({
262
262
"event" : "$delete" ,
263
263
"entityType" : "pio_item" ,
264
264
"entityId" : iid ,
265
265
"appId" : self .app_id ,
266
- "eventTime" : eventTime .isoformat (),
266
+ "eventTime" : event_time .isoformat (),
267
267
})
268
268
269
- def delete_item (self , iid , eventTime = None ):
270
- return self .adelete_item (iid , eventTime ).get_response ()
269
+ def delete_item (self , iid , event_time = None ):
270
+ return self .adelete_item (iid , event_time ).get_response ()
271
271
272
272
def arecord_user_action_on_item (self , action , uid , iid , properties = {},
273
- eventTime = None ):
274
- eventTime = now_if_none (eventTime )
273
+ event_time = None ):
274
+ event_time = now_if_none (event_time )
275
275
return self .acreate_event ({
276
276
"event" : action ,
277
277
"entityType" : "pio_user" ,
@@ -280,20 +280,20 @@ def arecord_user_action_on_item(self, action, uid, iid, properties={},
280
280
"targetEntityId" : iid ,
281
281
"properties" : properties ,
282
282
"appId" : self .app_id ,
283
- "eventTime" : eventTime .isoformat (),
283
+ "eventTime" : event_time .isoformat (),
284
284
})
285
285
286
286
def record_user_action_on_item (self , action , uid , iid , properties = {},
287
- eventTime = None ):
287
+ event_time = None ):
288
288
return self .arecord_user_action_on_item (
289
- action , uid , iid , properties , eventTime ).get_response ()
289
+ action , uid , iid , properties , event_time ).get_response ()
290
290
291
291
292
- class PredictionClient (BaseClient ):
292
+ class EngineClient (BaseClient ):
293
293
"""Client for extracting prediction results from PredictionIO Engine."""
294
294
def __init__ (self , url = "http://localhost:8000" , threads = 1 ,
295
295
qsize = 0 , timeout = 5 ):
296
- super (PredictionClient , self ).__init__ (url , threads , qsize , timeout )
296
+ super (EngineClient , self ).__init__ (url , threads , qsize , timeout )
297
297
298
298
def asend_query (self , data ):
299
299
path = "/"
0 commit comments