python2/3 compatibility fix

This commit is contained in:
Gavin M. Roy 2016-09-14 00:32:16 -04:00
parent b73679c57a
commit 821b80291b
2 changed files with 3 additions and 2 deletions

View file

@ -89,7 +89,8 @@ class InfluxDBMixin(object):
if hasattr(self, 'correlation_id'):
self.influxdb.set_field('correlation_id', self.correlation_id)
self.influxdb.set_field('duration', self.request.request_time())
parsed = headers.parse_content_type(self._headers['Content-Type'])
parsed = headers.parse_content_type(
self._headers['Content-Type'].decode('utf-8'))
self.influxdb.set_tag(
'content_type', '{}/{}'.format(
parsed.content_type, parsed.content_subtype))

View file

@ -156,7 +156,7 @@ class FakeInfluxDBHandler(web.RequestHandler):
payload = self.request.body.decode('utf-8')
for line in payload.splitlines():
LOGGER.debug('Line: %r', line)
parts = LINE_PATTERN.match(line.encode('utf-8'))
parts = LINE_PATTERN.match(line)
name, tags_str, fields_str, timestamp = parts.groups()
matches = TAG_PATTERN.findall(tags_str)