Skip to content

Instantly share code, notes, and snippets.

@andrefsp
Last active February 9, 2016 23:36
Show Gist options
  • Select an option

  • Save andrefsp/e6115b6de50de00eba1d to your computer and use it in GitHub Desktop.

Select an option

Save andrefsp/e6115b6de50de00eba1d to your computer and use it in GitHub Desktop.

Revisions

  1. andrefsp renamed this gist Feb 9, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. andrefsp created this gist Feb 9, 2016.
    17 changes: 17 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    import gevent
    from gevent import monkey
    monkey.patch_all()

    import requests

    def fetch_request(url):
    print("fetching %s" % url)
    requests.get(url)
    print("Finish fetching %s" % url)


    jobs = []
    for url in ("http://google.com", "http://facebook.com"):
    jobs.append(gevent.spawn(fetch_request, url))

    gevent.joinall(jobs)