Пример #1
0
def decode_tile_request_log(a):
    b = a.split("\t")
    return {
        "status": b[0],
        "tileorigin": b[1],
        "tilesource": b[2],
        "z": int(b[3]),
        "x": int(b[4]),
        "y": int(b[5]),
        "extension": b[6],
        "ip": b[7],
        "datetime": parse_date(b[8]),
    }
Пример #2
0
def decode_tile_request_log(a):
    b = a.split("\t")
    return {
        'status': b[0],
        'tileorigin': b[1],
        'tilesource': b[2],
        'z': int(b[3]),
        'x': int(b[4]),
        'y': int(b[5]),
        'extension': b[6],
        'ip': b[7],
        'datetime': parse_date(b[8])
    }
    def _receive_tile_requests_kafka(self, response, now, ttl):
        messages_decoded = []
        for item in response:
            offset, message = item
            message_decoded = self._codec.decode_channel(message.value)
            itempart = message_decoded.split(";")
            date = parse_date(itempart[0])
            if not date:
                print "Date is missing or invalid!"
            elif is_expired(date, now, ttl):
                # print "Tile expired!"
                continue
            else:
                messages_decoded.append(itempart[1])  # Covert to dict within client application

        return messages_decoded
Пример #4
0
    def _receive_tile_requests_kafka(self, response, now, ttl):
        messages_decoded = []
        for item in response:
            offset, message = item
            message_decoded = self._codec.decode_channel(message.value)
            itempart = message_decoded.split(";")
            date = parse_date(itempart[0])
            if not date:
                print "Date is missing or invalid!"
            elif is_expired(date, now, ttl):
                # print "Tile expired!"
                continue
            else:
                messages_decoded.append(
                    itempart[1])  # Covert to dict within client application

        return messages_decoded
    def _receive_tile_requests_kinesis(self, response, now, ttl):
        self._channel._shard_it = response[u'NextShardIterator']
        messages_decoded = []
        for item in response[u'Records']:
            # partition_key = item[u'PartitionKey']
            message = item[u'Data']
            message_decoded = self._codec.decode_channel(message)
            itempart = message_decoded.split(";")
            date = parse_date(itempart[0])
            if not date:
                print "Date is missing or invalid!"
            elif is_expired(date, now, ttl):
                # print "Tile expired!"
                continue
            else:
                messages_decoded.append(itempart[1])  # Covert to dict within client application

        return messages_decoded
Пример #6
0
    def _receive_tile_requests_kinesis(self, response, now, ttl):
        self._channel._shard_it = response[u'NextShardIterator']
        messages_decoded = []
        for item in response[u'Records']:
            # partition_key = item[u'PartitionKey']
            message = item[u'Data']
            message_decoded = self._codec.decode_channel(message)
            itempart = message_decoded.split(";")
            date = parse_date(itempart[0])
            if not date:
                print "Date is missing or invalid!"
            elif is_expired(date, now, ttl):
                # print "Tile expired!"
                continue
            else:
                messages_decoded.append(
                    itempart[1])  # Covert to dict within client application

        return messages_decoded