fix: handle missing user agent in request logs
This commit is contained in:
parent
4a053143f4
commit
fbe12249f8
|
|
@ -466,7 +466,10 @@ class MyLoggingMixin(object):
|
||||||
|
|
||||||
def _get_agent(self, request):
|
def _get_agent(self, request):
|
||||||
"""Get os string"""
|
"""Get os string"""
|
||||||
return str(parse(request.META['HTTP_USER_AGENT']))
|
user_agent = request.META.get('HTTP_USER_AGENT', '')
|
||||||
|
if not user_agent:
|
||||||
|
return ''
|
||||||
|
return str(parse(user_agent))
|
||||||
|
|
||||||
def _get_response_ms(self):
|
def _get_response_ms(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue