Get multiple documents in a single request as a dictionary.
(self, keys)
| 123 | return unmarshal(response.json()) |
| 124 | |
| 125 | def get_many(self, keys): |
| 126 | """Get multiple documents in a single request as a dictionary.""" |
| 127 | if len(keys) > 100: |
| 128 | # Process in batches to avoid crossing the URL length limit. |
| 129 | d = {} |
| 130 | for chunk in web.group(keys, 100): |
| 131 | d.update(self._get_many(chunk)) |
| 132 | return d |
| 133 | else: |
| 134 | return self._get_many(keys) |
| 135 | |
| 136 | def _get_many(self, keys): |
| 137 | response = self._request("/api/get_many", params={"keys": json.dumps(keys)}) |