Created
January 16, 2010 23:25
-
-
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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