Skip navigation.

Python - Script - Which Webserver Does That Site Run?

Python - Script - Which Webserver Does That Site Run?

You can use this little Python function to see what type of web server a site is running.  All it does is send an HTTP request to the host and reads the 'server' header in the response.

 import httplib def get_server_type(host): conn = httplib.HTTPConnection(host)
conn.request('GET', '/') resp = conn.getresponse() return resp.getheader('server')
print get_server_type('www.pylot.org') print get_server_type('www.techcrunch.com') 

Output:

lighttpd/1.4.19
Apache/2.0.52


Note: This doesn't work for all sites