MCPcopy Create free account
hub / github.com/astral-sh/python-build-standalone / get_asset

Function get_asset

src/github_api_tester.py:248–264  ·  view source on GitHub ↗
(id, org=None, repo=None)

Source from the content-addressed store, hash-verified

246@app.route("/get_asset/<int:id>")
247@app.route("/repos/<org>/<repo>/releases/assets/<int:id>")
248async def get_asset(id, org=None, repo=None):
249 try:
250 asset = Asset._ASSETS[id]
251 except IndexError:
252 quart.abort(
253 404, response=quart.jsonify({"message": "Not Found", "status": "404"})
254 )
255
256 if "application/octet-stream" in request.accept_mimetypes:
257 if asset.contents is None:
258 print(
259 f"USAGE ERROR: Received request for contents of {asset.filename=} which was not stored"
260 )
261 return "Did not store contents", 410
262 return asset.contents
263 else:
264 return asset.render()
265
266
267# Generic upload function, useful for testing clients in isolation

Callers

nothing calls this directly

Calls 1

renderMethod · 0.45

Tested by

no test coverage detected