API Reference

This section contains the complete API reference for nepse-client.

Overview

The nepse-client library is organized into several modules:

Main Modules

nepse_client

The main module containing the public API:

nepse_client.NepseClient

Synchronous client for NEPSE API.

nepse_client.AsyncNepseClient

Asynchronous client for NEPSE API.

Client Modules

Base and implementation classes:

nepse_client.client

Base client implementation for NEPSE API.

nepse_client.sync_client

Synchronous NEPSE client implementation.

nepse_client.async_client

Asynchronous NEPSE client implementation.

Support Modules

Token and ID management:

nepse_client.token_manager

Token management for NEPSE API authentication.

nepse_client.dummy_id_manager

Dummy ID management for NEPSE API requests.

Exception Handling

Custom exceptions for error handling:

nepse_client.exceptions

Custom exceptions for NEPSE Client.

Package Information

Version Information

from nepse_client import __version__, __author__

print(__version__)  # e.g., '1.0.0'
print(__author__)   # e.g., 'Amrit Giri'

Available Exports

The following are available from the main package:

Client Classes:

Exception Classes:

Usage Examples

Basic Import

from nepse_client import NepseClient, AsyncNepseClient

# Synchronous client
client = NepseClient()

# Asynchronous client
async_client = AsyncNepseClient()

Exception Handling

from nepse_client import (
   NepseClient,
   NepseError,
   NepseServerError,
   NepseAuthenticationError
)

client = NepseClient()

try:
   data = client.getMarketStatus()
except NepseAuthenticationError:
   print("Authentication failed")
except NepseServerError:
   print("Server error")
except NepseError as e:
   print(f"General error: {e}")

Type Hints

All public APIs include type hints:

from nepse_client import NepseClient
from typing import Dict, List, Any

client: NepseClient = NepseClient()

# Return types are properly annotated
status: Dict[str, Any] = client.getMarketStatus()
companies: List[Dict[str, Any]] = client.getCompanyList()

Module Index