def main(param): x = Videos() hash = param['hash'] publc = param['publc'] # create a hash m = md5.new(publc + _private_key()) # check if this hash is equal to the one transmitted if m.hexdigest() == hash: data = x.allPublic(param) if data: obj = {} i = 0 for item in data: obj[i] = { 'id' : item[0], 'category' : item[1], 'tags' : item[2], 'data' : item[3] #'date_added': item[4] } i = i + 1 else: obj = False dat = { 'data': obj, 'records': x.countRecords('videos', '', 1), 'id': 1234 } else: dat = { 'data': False, 'records': 0, 'id': 1234 } return dat