Skip to content

Instantly share code, notes, and snippets.

@reite
Last active December 30, 2015 00:59
Show Gist options
  • Save reite/7753128 to your computer and use it in GitHub Desktop.
Save reite/7753128 to your computer and use it in GitHub Desktop.
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