def playlists(param): x = Playlists() data = False records = 0 hash = param['hash'] publc = param['publc'] username = param['username'] src = param['src'] if username == 'false': username = '' param = { 'username' : username, 'curPage' : param['curPage'], 'limit' : param['limit'] } m = md5.new(publc + _private_key()) if username: # check if this hash is equal to the one transmitted if m.hexdigest() == hash: if src == 'home': data = x.getPublicPlaylists(param) records = x.getPublicPlaylistsCount(param) else: data = x.getPlaylists(param) else: # check if this hash is equal to the one transmitted if m.hexdigest() == hash: data = x.getPublicPlaylists(param) records = x.getPublicPlaylistsCount(param) return { 'data': data, 'records': records, 'id': 1234 }