feat: refactor Python SDK and enhance API error reporting

- Relocated Python SDK to `sdk/python/datastack` with new auto-configuration support via `config.datastack.py`
- Updated SDK installation and usage documentation
- Enhanced `/api/events` response format to include specific error codes for revoked and rotated credentials
- Updated SDK dashboard snippet generator to support new configuration pattern
This commit is contained in:
Team Dark Devil committed 2026-11-18 02:23:01 +06:00
1 parent 367dd819f8
commit 0c2e49cd47
18 files changed
+2288 -249

No files matched your search

+10 -13
View File
@@ -7,23 +7,20 @@ export const SdkSection: React.FC = () => (
<SectionHeading index="02" label="Python SDK" title="Drop in the SDK. Start streaming." />
<div className="grid grid-cols-1 gap-px border border-[var(--border)] bg-[var(--border)] md:grid-cols-2">
<CodeBlock>
<span className="text-[var(--text-faint)]"># Install the client</span>{'\n'}
<span className="text-[var(--text)]">pip install ./sdk-python</span>{'\n\n'}
<span className="text-[var(--text-faint)]"># Send an event</span>{'\n'}
<span className="text-[var(--text)]">from datastack_sdk import DataStackClient</span>{'\n\n'}
<span className="text-[var(--text)]">client = DataStackClient(</span>{'\n'}
{' '}server_url=<span className="text-[var(--accent)]">&quot;YOUR_SERVER_URL&quot;</span>,{'\n'}
{' '}token=<span className="text-[var(--accent)]">&quot;YOUR_CLIENT_TOKEN&quot;</span>,{'\n'}
<span className="text-[var(--text)]">)</span>{'\n\n'}
<span className="text-[var(--text)]">if client.connect():</span>{'\n'}
{' '}client.sync({'{'}<span className="text-[var(--accent)]">&quot;event&quot;</span>: <span className="text-[var(--accent)]">&quot;package_received&quot;</span>{'}'}){'\n'}
{' '}client.disconnect()
<span className="text-[var(--text-faint)]"># Install the official Python SDK</span>{'\n'}
<span className="text-[var(--text)]">pip install ./sdk/python/datastack</span>{'\n\n'}
<span className="text-[var(--text-faint)]"># Auto-loads config.datastack.py from project root</span>{'\n'}
<span className="text-[var(--text)]">from datastack import DataStack</span>{'\n\n'}
<span className="text-[var(--text)]">client = DataStack()</span>{'\n'}
<span className="text-[var(--text)]">client.send({'{'}<span className="text-[var(--accent)]">&quot;event&quot;</span>: <span className="text-[var(--accent)]">&quot;package_received&quot;</span>{'}'})</span>{'\n'}
<span className="text-[var(--text)]">client.send_file(<span className="text-[var(--accent)]">&quot;telemetry_batch.csv&quot;</span>)</span>{'\n'}
<span className="text-[var(--text)]">client.disconnect()</span>
</CodeBlock>
<div className="bg-[var(--surface)] p-5 sm:p-6">
<p className="mb-2 text-[11px] uppercase text-[var(--text-faint)]">How it works</p>
<h3 className="mb-2 text-[14px] font-medium text-[var(--text)]">A small client. A clear workflow.</h3>
<h3 className="mb-2 text-[14px] font-medium text-[var(--text)]">Zero-boilerplate config. Auto-recovery built in.</h3>
<p className="text-[12px] leading-relaxed text-[var(--text-muted)]">
Connect a Python source, send individual or batched events, then review and export activity from one workspace.
Drop <code className="text-[var(--text)]">config.datastack.py</code> into your Python project to stream single events, batches, or <code className="text-[var(--text)]">.csv</code> / <code className="text-[var(--text)]">.json</code> files directly—with automatic HTTP fallback, offline disk spooling, and Heartbeat IDLE recovery.
</p>
</div>
</div>