Created
May 30, 2012 16:29
-
-
Save sankroh/2837450 to your computer and use it in GitHub Desktop.
Requests test
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
import requests | |
import time | |
def run(): | |
output = [] | |
for x in range(100): | |
resp = requests.get("http://perf.herokuapp.com") | |
output.append(resp.text) | |
print output | |
if __name__ == '__main__': | |
start = time.time() | |
run() | |
end = time.time() | |
print "Time elapsed: ", end-start |
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
import urllib2 | |
import time | |
def run(): | |
output = [] | |
for x in range(100): | |
req = urllib2.Request('http://perf.herokuapp.com') | |
resp = urllib2.urlopen(req) | |
output.append(resp.read()) | |
print output | |
if __name__ == '__main__': | |
start = time.time() | |
run() | |
end = time.time() | |
print "Time elapsed: ", end-start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment