Facade API Reference#

Super-simple unified facade for automatically detecting and parsing any NSE or BSE XBRL filing.

Auto-Detecting Functions#

async nse_xbrl_parser.parse(source, source_name=None)[source]#

Super-simple facade function: auto-detects filing type and parses any XML asynchronously.

Parameters:
  • source (str | bytes | Path) – File path, XML string, or raw XML bytes.

  • source_name (str | None) – Optional file or tracking name.

Returns:

Unified result with .format, .data, and direct field access.

Return type:

ParsedFiling

nse_xbrl_parser.parse_sync(source, source_name=None)[source]#

Synchronous facade function: auto-detects filing type and parses any XML.

Parameters:
Return type:

ParsedFiling

Unified Facade Class#

class nse_xbrl_parser.XBRL[source]#

Bases: object

Super-simple unified facade API. Give any XML / file / bytes, and it automatically parses.

async classmethod parse(source, source_name=None)[source]#

Auto-detect format and parse any XML file, path, string, or raw bytes asynchronously.

Parameters:
  • source (str | bytes | Path) – A filepath (str or Path), raw XML string, or XML bytes.

  • source_name (str | None) – Optional name for tracking.

Returns:

Unified result with .format, .data, and typed fields.

Return type:

ParsedFiling

classmethod parse_sync(source, source_name=None)[source]#

Synchronous version: auto-detect and parse any XML file, string, or bytes.

Parameters:
Return type:

ParsedFiling

Filing Results & Formats#

class nse_xbrl_parser.ParsedFiling(*, format, raw_instance, financial_results=None, shareholding_pattern=None, corporate_governance=None, investor_complaints=None)[source]#

Bases: BaseModel

Unified container returned by the parser facade with auto-detected format and typed model.

Parameters:
format: FilingFormat#
raw_instance: XBRLInstance#
financial_results: FinancialResultsModel | None#
shareholding_pattern: ShareholdingPatternModel | None#
corporate_governance: CorporateGovernanceModel | None#
investor_complaints: InvestorComplaintsModel | None#
property data: FinancialResultsModel | ShareholdingPatternModel | CorporateGovernanceModel | InvestorComplaintsModel | XBRLInstance#

Convenience property returning the typed model if available, else raw XBRLInstance.

property company_name: str | None#
property scrip_code: str | None#
property symbol: str | None#
to_dict()[source]#

Serialize data to Python dictionary.

Return type:

Dict[str, Any]

model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class nse_xbrl_parser.FilingFormat(*values)[source]#

Bases: str, Enum

Identified filing format of an XBRL filing.

FINANCIAL_RESULTS = 'financial_results'#
SHAREHOLDING_PATTERN = 'shareholding_pattern'#
CORPORATE_GOVERNANCE = 'corporate_governance'#
INVESTOR_COMPLAINTS = 'investor_complaints'#
GENERIC = 'generic'#
nse_xbrl_parser.detect_filing_format(instance)[source]#

Analyze namespaces, schema references, and fact tags to detect the filing type.

Parameters:

instance (XBRLInstance)

Return type:

FilingFormat