MCPcopy Create free account
hub / github.com/internetarchive/openlibrary / get_many

Method get_many

openlibrary/api.py:125–134  ·  view source on GitHub ↗

Get multiple documents in a single request as a dictionary.

(self, keys)

Source from the content-addressed store, hash-verified

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)})

Callers

nothing calls this directly

Calls 3

_get_manyMethod · 0.95
lenFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected