def encode(self, tilesource=None, tiles=None, extension=None, now=None): messages = [] for tile in tiles: x, y, z = tile message = FORMAT_TILE_REQUEST.format(d=now.isoformat(), tilesource=tilesource, z=str(z), x=str(x), y=str(y), ext=extension) messages.append(self.encode_channel(message)) return messages
def pack(self, tilesource=None, tiles=None, extension=None, now=None): """ pack messages for store """ messages = [] for tile in tiles: x, y, z = tile message = FORMAT_TILE_REQUEST.format(d=now.isoformat(), tilesource=tilesource, z=str(z), x=str(x), y=str(y), ext=extension) messages.append(message) return "\n".join(messages)