Esempio n. 1
0
    def handle_request_data(self, request, response, error=False):
        len = 0 if error else response.getheader('Content-Length')
        now = datetime.now()
        time = now.strftime('%Y-%m-%d %H:%M:%S')
        td = (now - request.start_time)
        duration = (td.microseconds + long_type(td.seconds + td.days * 24 * 3600) * 1e6) / 1e6

        # write output including timestamp, status code, response time, response size, request action
        self.request_log_queue.put("'%s', '%s', '%s', '%s', '%s'\n" % (time, response.status, duration, len, request.params['Action']))
Esempio n. 2
0
File: property.py Progetto: 10sr/hue
 def validate(self, value):
     value = long_type(value)
     value = super(LongProperty, self).validate(value)
     min = -9223372036854775808
     max = 9223372036854775807
     if value > max:
         raise ValueError('Maximum value is %d' % max)
     if value < min:
         raise ValueError('Minimum value is %d' % min)
     return value
Esempio n. 3
0
 def validate(self, value):
     value = long_type(value)
     value = super(LongProperty, self).validate(value)
     min = -9223372036854775808
     max = 9223372036854775807
     if value > max:
         raise ValueError('Maximum value is %d' % max)
     if value < min:
         raise ValueError('Minimum value is %d' % min)
     return value
Esempio n. 4
0
 def decode_long(self, value):
     value = long_type(value)
     value -= 9223372036854775808
     return value
Esempio n. 5
0
 def encode_long(self, value):
     value = long_type(value)
     value += 9223372036854775808
     return '%020d' % value
Esempio n. 6
0
 def decode_long(self, value):
     value = long_type(value)
     value -= 9223372036854775808
     return value
Esempio n. 7
0
 def encode_long(self, value):
     value = long_type(value)
     value += 9223372036854775808
     return '%020d' % value