Last active
December 11, 2015 03:09
-
-
Save amccloud/4536064 to your computer and use it in GitHub Desktop.
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
from collections import Counter | |
import requests | |
# Top Django site's from djangoproject.com, stackoverflow.com, and quora.com. | |
# I've determined the two unknowns, rdio.com and washingtonpost.com, are nginx. | |
urls = [ | |
'http://djangoproject.com/', | |
'http://disqus.com/', | |
'http://instagram.com/', | |
'http://addons.mozilla.org/', | |
'http://pinterest.com/', | |
'http://politifact.com/', | |
'http://rdio.com/', | |
'http://bitbucket.org/', | |
'http://lanyrd.com/', | |
'http://ljworld.com', | |
'http://mahalo.com/', | |
'http://theonion.com/', | |
'http://nationalgeographic.com/', | |
'http://zoosk.com/', | |
'http://washingtonpost.com/', | |
'http://guardian.co.uk/', | |
'http://giantbomb.com/', | |
'http://everyblock.com/', | |
'http://comicvine.com/', | |
'http://eldarion.com/', | |
'http://flavors.me/', | |
'http://goodsie.com/', | |
'http://grove.io/', | |
'http://prezi.com/', | |
'http://npr.org/', | |
'http://science.nasa.gov/', | |
'http://djangopackages.com/', | |
'http://readthedocs.org/', | |
'http://michaelmoore.com/', | |
] | |
server_count = Counter() | |
for url in urls: | |
try: | |
r = requests.get(url) | |
except requests.exceptions.ConnectionError, e: | |
print 'Skipping %s, %s' % (url, e) | |
continue | |
if r.status_code != 200: | |
continue | |
server_name = r.headers.get('server', 'unknown').split('/', 1)[0].lower() | |
server_count[server_name] += 1 | |
print '%s: %s' % (server_name, url) | |
print server_count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment