Skip to main content

Drishti SDK (Python)

Official Python SDK for the Manasija Drishti API (/v1).

This SDK provides:

  • A synchronous HTTP client with named-argument endpoint helpers
  • A low-level request interface for advanced/custom usage
  • A WebSocket client for real-time streams (/v1/ws)
  • Configurable retry/backoff for transient HTTP failures

Requirements

  • Python 3.10+
  • A valid Drishti API key

Installation

pip install drishti-sdk

Quick Start

from drishti_sdk import DrishtiClient

with DrishtiClient(api_key="YOUR_API_KEY") as client:
    news = client.get_news(
        symbols=["RELIANCE", "TCS"],
        limit=10,
    )
    block_deals = client.get_block_deals(
        symbols=["RECLTD", "NAUKRI"], exchange="NSE", limit=20
    )  # 1 credit when results are returned

    symbol_universe = client.get_symbols(format="json")

    summary = client.post_daily_summary(
        request={
            "symbols": ["RELIANCE", "TCS"],
            "mode": "news_context",
            "context_window_days": 7,
        }
    )
    print(len(news["data"]))

All requests automatically include X-API-Key using the provided api_key.

Retry Configuration

Retries are configurable globally on the client and per request.

from drishti_sdk import DrishtiClient

with DrishtiClient(
    api_key="YOUR_API_KEY",
    retry_max_retries=3,
    retry_initial_delay=0.25,
    retry_max_delay=4.0,
    retry_multiplier=2.0,
    retry_on_statuses=(408, 429, 500, 502, 503, 504),
) as client:
    # Per-request override
    news = client.request(
        "GET",
        "/v1/news",
        params={"limit": 10},
        retry_max_retries=1,
    )

HTTP Usage

from drishti_sdk import DrishtiClient

with DrishtiClient(api_key="YOUR_API_KEY") as client:
    announcements = client.get_announcements(
        symbols=["RELIANCE"],
        categories=["Corporate Action"],
        important=True,
        detailed=True,
        limit=20,
    )

    earnings = client.get_earnings_detail(
        symbol="MEDIASSIST",
        quarter="q4_26",
        detailed=True,
    )

    earnings_rows = client.get_earnings(
        ids=["67c2f8a1b2c3d4e5f6a7b8d0"],
        limit=5,
    )

    transcript = client.get_concalls_transcript(
        symbol="TCS",
        quarter="q4_26",
    )

    alerts = client.get_alerts(
        symbols=["INFY"],
        important=True,
        limit=25,
    )

Error Handling

from drishti_sdk import DrishtiApiError, DrishtiClient

try:
    with DrishtiClient(api_key="YOUR_API_KEY") as client:
        client.get_account()
except DrishtiApiError as exc:
    print(exc.status_code)
    print(exc.body)
    raise

WebSocket Usage (/v1/ws)

Event listeners

import asyncio
from drishti_sdk import DrishtiClient


async def main() -> None:
    client = DrishtiClient(api_key="YOUR_API_KEY")
    async with client.websocket(
        reconnect_initial_delay=1.0,
        reconnect_max_delay=30.0,
        on_reconnect_attempt=lambda attempt, delay, reason: print(attempt, delay, reason),
        on_data=lambda event: print(event.data) if event.kind == "data" else None,
        on_announcements=lambda announcement: print("announcement", announcement),
        on_alerts=lambda alert: print("alert", alert),
    ) as ws:
        await ws.subscribe("alerts", symbols=["RELIANCE"])
        await asyncio.Event().wait()  # listeners run in the background; Ctrl+C to stop


asyncio.run(main())

Async iterator style

async with client.websocket() as ws:
    await ws.subscribe(
        "announcements",
        symbols=["RELIANCE"],
        categories=["Dividend", "Board Meeting"],
        detailed=False,
    )
    async for event in ws.events():
        if event.kind == "subscribed":
            print("ready", event.product, event.tier)
        elif event.kind == "data":
            print(event.channel, event.data)

Register listeners after connect:

def on_announcement(announcement: dict[str, object]) -> None:
    print("announcement", announcement)

ws.on_announcements(on_announcement)
ws.off("announcements", on_announcement)

WebSocket Reference

The WebSocket session is created from the HTTP client, so it inherits the same api_key and base_url settings. The session connects to /v1/ws and sends X-API-Key on connect.

Supported subscription products:

  • news
  • block_deals
  • announcements
  • earnings
  • concalls
  • alerts

Useful session options:

  • reconnect_initial_delay
  • reconnect_max_delay
  • reconnect_backoff_multiplier
  • reconnect_jitter_ratio
  • reconnect_warn_after_attempts
  • ping_interval
  • ping_timeout
  • open_timeout
  • close_timeout
  • max_queue
  • on_subscribed
  • on_data
  • on_news
  • on_block_deals
  • on_announcements
  • on_earnings
  • on_concalls
  • on_alerts
  • on_error
  • on_message
  • on_open
  • on_close
  • on_reconnect_attempt
  • on_reconnect_warning

The session connects automatically on the first async call (subscribe, events, or entering an async with block) and keeps retrying in the background after disconnects.

Subscription messages accept either SubscribeOptions(...) or the product name as a string. Symbols are normalized to uppercase and de-duplicated before the message is sent. Announcements subscriptions can also include categories, a list of primary category names. Category names are trimmed and de-duplicated, and their original casing is kept. An account can listen to at most 15 distinct announcement categories across all connections. Subscribing to a category that is already active on another connection does not use another slot. Omit categories when the account already receives every announcement category. Subscriptions are replayed after every reconnect.

Event shapes:

  • subscribed: acknowledgement with product, tier, full_feed, symbols, categories, and detailed
  • data: payload event with channel and data
  • error: error event with message and optional code
  • raw: unclassified JSON payload

Direct exports available from drishti_sdk:

  • DRISHTI_WS_PRODUCTS
  • SubscribeOptions
  • DrishtiWebSocketSession
  • DrishtiWebSocketClientSessionOptions
  • DataEvent
  • ErrorEvent
  • RawEvent
  • SubscribedEvent
  • WebSocketEvent
  • build_websocket_url
  • parse_websocket_message
  • stream_product

Batch Jobs

from drishti_sdk import DrishtiClient

with DrishtiClient(api_key="YOUR_API_KEY") as client:
    with open("batch.jsonl", "rb") as f:
        file_bytes = f.read()

    job = client.post_batch_jobs_file(
        file_name="batch.jsonl",
        file_bytes=file_bytes,
        display_name="Quarterly run",
    )

    status = client.get_batch_jobs_job_id(job_id=job["id"])

Wait until completion:

final_job = client.wait_for_batch_job_completion(
    job_id=job["id"],
    poll_interval=2.0,
    timeout=300.0,
)

Submit and wait in one call:

final_job = client.submit_batch_job_and_wait(
    file_name="batch.jsonl",
    file_bytes=file_bytes,
    display_name="Quarterly run",
    poll_interval=2.0,
    timeout=300.0,
)

API Surface

REST helper methods

  • get_news
  • get_block_deals (1 credit per returned item)
  • get_symbols
  • get_symbols_metadata
  • get_announcements_categories
  • get_announcements
  • get_announcements_attachments
  • get_announcement_citation_pdf
  • post_daily_summary
  • get_earnings_index
  • get_earnings
  • get_earnings_detail
  • get_earnings_attachments
  • get_earnings_citation_pdf
  • get_earnings_citation_page
  • get_upcoming_earnings
  • get_concalls
  • get_concall_citation_pdf
  • get_concalls_index
  • get_upcoming_concalls
  • get_concalls_detail
  • get_concalls_transcript
  • post_concalls_transcripts
  • get_alerts
  • get_account
  • get_account_limits
  • get_account_usage
  • get_account_ledger
  • post_batch_jobs
  • post_batch_jobs_file
  • get_batch_jobs
  • get_batch_jobs_job_id
  • delete_batch_jobs_job_id
  • get_batch_jobs_job_id_results
  • wait_for_batch_job_completion
  • submit_batch_job_and_wait
  • websocket

Low-level HTTP methods

  • request
  • get
  • post
  • put
  • patch
  • delete
  • request_v1

Development

pip install -e .[dev]

Metadata

Release files for drishti-sdk 1.0.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drishti-sdk 1.0.17
File Size Uploaded
drishti_sdk-1.0.17.tar.gz 18.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drishti-sdk 1.0.17
File Interpreter ABI Platform
drishti_sdk-1.0.17-py3-none-any.whl Python 3 none any Details

Total release size: 40.0 kB

Release files / drishti_sdk-1.0.17.tar.gz

Download URL drishti_sdk-1.0.17.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8aaf3b87666a59c66521eca6032574b5c7a06eb416f2af45c7932ffe85f0df0c
BLAKE2b-256 checksum
How to use checksums
165f97380bbdd641e147309cdf5b57cac1d2c03efe8d4fa0373778a860392266
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release files / drishti_sdk-1.0.17-py3-none-any.whl

Download URL drishti_sdk-1.0.17-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
921a02dd95500b3950b5a7e5bd7739626c165b729faff7132a12d6f74b2b8bb6
BLAKE2b-256 checksum
How to use checksums
22cae9acbddbc90f59627b89d5fc909ac6ca6bd14f6d3d2a63d717b55148550a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.17 This release

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.1

2 release files

0.2.0

2 release 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