|
594 | 594 | permissions checks explicitly.</p> |
595 | 595 | </dd></dl> |
596 | 596 |
|
| 597 | +<dl class="py method"> |
| 598 | +<dt class="sig sig-object py" id="octoprint.plugin.BlueprintPlugin.limit"> |
| 599 | +<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">limit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#octoprint.plugin.BlueprintPlugin.limit" title="Link to this definition"></a></dt> |
| 600 | +<dd><p>A decorator to rate limit a view method in your BlueprintPlugin.</p> |
| 601 | +<p>See <a class="reference external" href="https://flask-limiter.readthedocs.io/en/stable/api.html#flask_limiter.Limiter.limit">the documentation for flask_limiter.Limiter.limit</a> |
| 602 | +for more information.</p> |
| 603 | +</dd></dl> |
| 604 | + |
597 | 605 | <dl class="py method"> |
598 | 606 | <dt class="sig sig-object py" id="octoprint.plugin.BlueprintPlugin.route"> |
599 | 607 | <em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">route</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rule</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">options</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#octoprint.plugin.BlueprintPlugin.route" title="Link to this definition"></a></dt> |
|
1201 | 1209 | <dd><p>Return True if the API is only available to users having the admin role.</p> |
1202 | 1210 | </dd></dl> |
1203 | 1211 |
|
| 1212 | +<dl class="py method"> |
| 1213 | +<dt class="sig sig-object py" id="octoprint.plugin.SimpleApiPlugin.is_api_protected"> |
| 1214 | +<span class="sig-name descname"><span class="pre">is_api_protected</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.13)"><span class="pre">bool</span></a></span></span><a class="headerlink" href="#octoprint.plugin.SimpleApiPlugin.is_api_protected" title="Link to this definition"></a></dt> |
| 1215 | +<dd><p>Whether a SimpleApi’s endpoints requires a valid user to be logged in to access it. For now, this defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code> to leave it up to |
| 1216 | +plugins to decide whether the endpoints <em>should</em> be protected. Long term, this will default to <code class="docutils literal notranslate"><span class="pre">True</span></code> and hence |
| 1217 | +enforce protection unless a plugin opts out by returning False here.</p> |
| 1218 | +<p>If you do not override this method in your mixin implementation, a warning will be logged to the console |
| 1219 | +to alert you of the requirement to make a decision here and to not rely on the default implementation, due to the |
| 1220 | +forthcoming change in implemented default behaviour.</p> |
| 1221 | +<p>Be advised that by returning <code class="docutils literal notranslate"><span class="pre">True</span></code> here, OctoPrint will only check whether a valid user is logged in before forwarding |
| 1222 | +the request to your implementation. However, you <em>really should</em> add additional permission checks specific to your plugin into your API |
| 1223 | +endpoints.</p> |
| 1224 | +<div class="versionadded"> |
| 1225 | +<p><span class="versionmodified added">Added in version 1.11.2.</span></p> |
| 1226 | +</div> |
| 1227 | +</dd></dl> |
| 1228 | + |
1204 | 1229 | <dl class="py method"> |
1205 | 1230 | <dt class="sig sig-object py" id="octoprint.plugin.SimpleApiPlugin.on_api_command"> |
1206 | 1231 | <span class="sig-name descname"><span class="pre">on_api_command</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">command</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#octoprint.plugin.SimpleApiPlugin.on_api_command" title="Link to this definition"></a></dt> |
|
0 commit comments