Last active
January 2, 2016 06:39
-
-
Save nemith/8264727 to your computer and use it in GitHub Desktop.
Juniper website fail
This file contains hidden or 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
| Code Count Pecetage | |
| 200: 65 65.0% | |
| 404: 35 35.0% |
This file contains hidden or 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
| 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