Skip to main content

filingstudio-proxy

Server-side proxy for Filing Studio on FastAPI. Your API key stays on your server; the browser talks only to your route. This is the Python twin of @filingstudio/proxy (Next.js and Express), with the same contract, so @filingstudio/react works unchanged in front of it.

pip install filingstudio-proxy
import os
from fastapi import FastAPI
from filingstudio_proxy import filing_studio_router

app = FastAPI()
app.include_router(
    filing_studio_router(api_key=os.environ["FILING_STUDIO_API_KEY"]),
    prefix="/api/filings",
)

Then in the browser: <ProvenanceProvider proxy="/api/filings">.

Public demo? Cap each visitor

filing_studio_router(api_key=key, budget=40)   # 40 metered requests per visitor per day

Over budget the route answers 429 with an honest note the drawer shows ("Daily demo limit reached… This says nothing about what the filings contain"), never a fake "not found". Coverage checks are never metered, and cached answers are served before the meter, so reopening a receipt is free.

Meter on your own login instead of the visitor IP:

filing_studio_router(
    api_key=key,
    budget=100,
    visitor_key=lambda req: req.state.user_id,
    limit_for=lambda req: req.state.daily_limit,   # optional per-user quota
)

What it guarantees

  • Only GET and POST, only to an allowlist of /v1 read paths. Dot segments and backslashes are refused before allowlisting.
  • Nothing from the browser request is forwarded except the /v1 path, its query string, and a POST body (capped at 64 KB).
  • Successful GETs are cached in-process (one hour by default) and served before the meter. Errors are never cached.
  • The reply carries X-FS-Demo-Remaining when metered; the React SDK's onLimit reads it.
  • A missing key answers 503; an unreachable upstream answers 502. Neither message can contain the key.

Options

option default meaning
api_key required your fsk_… key, server-side only
base_url https://api.filingstudio.com upstream base
allow search, trace, traces, verify, coverage, filings, tables allowed /v1 prefixes
cache_ttl_s 3600 GET cache TTL; 0 disables
budget None per-visitor daily cap (int) or a shared Budget
visitor_key client IP, cookie fallback who a request is charged to
limit_for None per-request quota override
timeout_s 30 upstream timeout
transport None an httpx transport, for tests

Develop

pip install -e .[test]
pytest

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

filingstudio_proxy-0.2.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

filingstudio_proxy-0.2.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file filingstudio_proxy-0.2.0.tar.gz.

File metadata

  • Download URL: filingstudio_proxy-0.2.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.5

File hashes

Hashes for filingstudio_proxy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 368644f3241713f5367a360aeace5f32635c00dac3f0a4e5b673dcda32451d67
MD5 3fffa92e0e126929f5910b410c45fb84
BLAKE2b-256 7bf20730703d462c68270eaed61e74b458d8388640bf46c871d7a6b67a380ee4

See more details on using hashes here.

File details

Details for the file filingstudio_proxy-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for filingstudio_proxy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c796382827cc651e2d5b80ea063ad2615e43fbd558b753482aa6525c606ccd0a
MD5 8819100ba6094613a2a30891533de56e
BLAKE2b-256 6cd6708f9b733e8a21314d2db015b1dc07fc3611ec2e0fc8f6195518d9664f2e

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.0

2 files

This release

0.2.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page