MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / api_access

Function api_access

src/octoprint/server/util.py:92–103  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

90
91
92def api_access(func):
93 @wraps(func)
94 def decorated_view(*args, **kwargs):
95 if not settings().get(["api", "enabled"]):
96 make_response("API disabled", 401)
97 apikey = getApiKey(request)
98 if apikey is None:
99 make_response("No API key provided", 401)
100 if apikey != settings().get(["api", "key"]):
101 make_response("Invalid API key", 403)
102 return func(*args, **kwargs)
103 return decorated_view
104
105
106def getUserForApiKey(apikey):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected