def report_statistics(spicename, userid): """ Reports statistics for this spice. One of the entries included must be 'spicename' to identify which spice is being reported on. Note that the spicerack daemon (who aggregates these results) will automatically keep track of the total number of uses for all spices. """ print "[statistics] Reporting use of spice:", spicename data = {'spicename' : spicename, 'userid' : userid} network_POST('/stats/report', data) print "[statistics] Finished report"
def report_feedback(userid): """ """ print "[statistics] Starting feedback send" fbpath = makepath('feedback.json') if not path_exists(fbpath): feedback = [] else: feedback = jsonload(fbpath) if len(feedback) > 0: data = {'feedback' : feedback, 'userid' : userid} network_POST('/stats/report_feedback', data) jsondump(makepath('feedback.json'), []) print '[statistics] Finished feedback send' altpath = makepath('feedback.txt') if path_exists(altpath): feedback = fileload(altpath) data = {'feedback' : feedback, 'userid' : userid} network_POST('/stats/report_legacy_feedback', data) command('rm', altpath)