Skip to content

Instantly share code, notes, and snippets.

@nemith
Last active January 2, 2016 06:39
Show Gist options
  • Select an option

  • Save nemith/8264727 to your computer and use it in GitHub Desktop.

Select an option

Save nemith/8264727 to your computer and use it in GitHub Desktop.
Juniper website fail
Code Count Pecetage
200: 65 65.0%
404: 35 35.0%
import requests
from collections import Counter
from time import sleep
response_codes = []
for x in xrange(0, 100):
r = requests.get("http://juniper.net")
response_codes.append(r.status_code)
print "Got %d" % r.status_code
# Lets be nice
sleep(.5)
print "Code Count Pecetage"
for code, count in Counter(response_codes).most_common():
print "{:^3}: {:^5} {:^8}".format(
code, count, str(100 * float(count)/len(response_codes)) + "%")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment