Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CSP-safe Mode

Strict Content Security Policies block inline <script>. The csp_safe() method extracts JS into a <script type="application/json"> payload + a single nonce-able loader.

Python

import seraplot as sp

chart = sp.line(x_labels=["1", "2", "3", "4"], values=[10, 20, 15, 25]).csp_safe()

Apply your CSP script-src 'nonce-sp-nonce' and the chart still renders.

Les CSP strictes bloquent les <script> inline. La méthode csp_safe() extrait le JS dans un payload <script type="application/json"> + un loader unique compatible nonce.

Python

import seraplot as sp

chart = sp.line(x_labels=["1", "2", "3", "4"], values=[10, 20, 15, 25]).csp_safe()

Applique ta CSP script-src 'nonce-sp-nonce' et le chart se rend toujours.