Skip to content

Instantly share code, notes, and snippets.

@rleyton
Created August 8, 2018 09:45
Show Gist options
  • Save rleyton/cfa82b9b312f518f4ece3840afb470df to your computer and use it in GitHub Desktop.
Save rleyton/cfa82b9b312f518f4ece3840afb470df to your computer and use it in GitHub Desktop.
Parse a UA stream and print out the key info
from ua_parser import user_agent_parser
import fileinput
for line in fileinput.input():
parsed=user_agent_parser.ParseUserAgent(line)
print("%s:%s" % (parsed['family'],parsed['major']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment