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

Function get_document

openlibrary/plugins/upstream/code.py:253–263  ·  view source on GitHub ↗
(key, limit_redirs=5)

Source from the content-addressed store, hash-verified

251
252@public
253def get_document(key, limit_redirs=5):
254 doc = None
255 for i in range(limit_redirs):
256 doc = web.ctx.site.get(key)
257 if doc is None:
258 return None
259 if doc.type.key == "/type/redirect":
260 key = doc.location
261 else:
262 return doc
263 return doc
264
265
266class revert(delegate.mode):

Callers

nothing calls this directly

Calls 2

rangeFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected