Last active
December 30, 2015 00:59
-
-
Save reite/7753128 to your computer and use it in GitHub Desktop.
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 | |
import grequests | |
import json | |
url = r'http://hotell.difi.no/api/json/brreg/enhetsregisteret?query=Merisma%20Development%20AS' | |
def sync(): | |
for _ in xrange(50): | |
print json.loads(requests.get(url).content)['posts'] | |
def async(): | |
reqs = [grequests.get(url) for i in xrange(50)] | |
res = grequests.map(reqs) | |
for r in res: | |
print json.loads(r.content)['posts'] | |
if __name__ == '__main__': | |
sync() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment