device_detector
device_detector copied to clipboard
self.all_details is None (?)
File "/app/main.py", line 184, in _ua
ua['device_type'] = parsed.device_type()
^^^^^^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.11/site-packages/device_detector/device_detector.py", line 560, in device_type
dt = self.all_details.get('device', {}).get('type', '')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
parsed.device
attribute also returns None, but it looks like here its self.all_details
that is causing the error. Thats not possible either cause I called .all_details
, and it is definitely not None.
parsed = DeviceDetector(request.user_agent.string).parse()
ua = parsed.all_details
ua['device'] = parsed.device
ua['device_type'] = parsed.device_type()