title: Batching API requests with flask-restful
body: <p>I'm building a REST API with flask-restful and one thing I'd like to enable is the ability to batch request resources, similar to how the Facebook Graph API works:</p>
  
  <pre><code>curl \
      -F 'access_token=…' \
      -F 'batch=[{"method":"GET", "relative_url":"me"},{"method":"GET", "relative_url":"me/friends?limit=50"}]' \
      https://graph.facebook.com
  </code></pre>
  
  <p>Which then returns an array with each request resolved with its status code and result:</p>
  
  <pre><code>[
      { "code": 200, 
        "headers":[
            { "name": "Content-Type", 
              "value": "text/javascript; charset=UTF-8" }
        ],
        "body": "{\"id\":\"…\"}"},
      { "code": 200,
        "headers":[
            { "name":"Content-Type", 
              "value":"text/javascript; charset=UTF-8"}
        ],
        "body":"{\"data\": [{…}]}}
  ]
  </code></pre>
  
  <p>I've been able to replicate this in flask-restful by simply looping over the requests and calling urlopen against my own app. This seems really inefficient and I have to think there's a better way. Is there a simpler and/or better way to make the requests against my own application from within a request handler? </p>