Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
data["content_length"] = doc_size
ua = {
"is_mobile": request.user_agent.is_mobile,
"is_pc": request.user_agent.is_pc,
"is_tablet": request.user_agent.is_tablet,
"is_bot": request.user_agent.is_bot,
"is_touch": request.user_agent.is_touch_capable,
"browser": request.user_agent.browser.family,
"browser_version": request.user_agent.browser.version_string,
"os": request.user_agent.os.family,
"os_version": request.user_agent.os.version_string,
"device": request.user_agent.device.family,
}
data["ua"] = ua
name = CONF.SITE_SLUG + "_hit" + str(HITNUM)
data["geo"] = serializer.getGeoData(data['ip'])
if CONF.COLLECTOR is True:
hit = serializer.pack(data)
R.set(name, hit)
else:
thread = Thread(target=dispatch, args=([data],))
thread.start()
HITNUM += 1
return response