Skip to content

Instantly share code, notes, and snippets.

@kylef
Created January 16, 2010 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kylef/279084 to your computer and use it in GitHub Desktop.
Save kylef/279084 to your computer and use it in GitHub Desktop.
Create a list of all unknown user agents in a django-request django project.
# This code grabs all unknown browsers in django-request on a django project.
from request.models import Request
from request.utils import browsers
requests = Request.objects.this_month().only('user_agent')
user_agents = [request.user_agent for request in requests]
unknown_agents = [agent for agent in user_agents if browsers.resolve(agent)[0] == 'Unknown']
print unknown_agents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment