Work with High Court records¶
HCServicesClient reads the High Court Services portal. Use it for case discovery, CNR details, orders and cause-list links rather than historical judgment metadata.
Discover the court and bench¶
Court codes such as delhi, bombay and calcutta come from the bundled registry. Bench and case-type codes come from the portal and can change.
import asyncio
from bharat_judgements import HCServicesClient, get_court
async def main():
court = get_court("delhi")
async with HCServicesClient() as client:
print("Benches:", await client.list_benches(court))
print("Case types:", await client.list_case_types(court, bench_code="1"))
records = await client.case_status_by_party(
court, party_name="tata", year="2024", bench_code="1"
)
for record in records:
print(record.case_number, record.cnr_number, record.petitioner, record.respondent)
asyncio.run(main())
Install bharat-judgements[ocr] for automatic CAPTCHA input. Without it, the default solver is manual. This example queries the principal bench; choose a returned bench code for another bench.
Identify a case¶
Use case_status with a Court, numeric case_type, case_number, registration year and bench. case_status_by_party requires the registration year and accepts Pending, Disposed or Both as status_filter.
These searches return CaseInfo lists. The search endpoint does not populate every field: a blank status or hearing date is missing metadata, not evidence of disposal or no upcoming hearing.
Read the CNR case page¶
case_status_by_cnr(cnr) returns CaseDetail, which can include case stage, coram, parties and advocates, acts, hearing history and orders. A 16-character alphanumeric CNR is required; spaces and hyphens are stripped.
Use the CNR returned by discovery to avoid mismatching a case. Sections absent from the source remain empty. The archive facade's find(cnr=...) is a different operation: it looks for historical judgments, not a live case page.
Retrieve orders¶
Call court_orders(court, case_type=..., case_number=..., year=..., bench_code=...) using the identifiers you discovered. Each CaseOrder can carry an order date, type and PDF URL. Download an available URL with download_order_pdf(url), which returns bytes.
The portal does not guarantee that every order has a downloadable copy. For Calcutta matters, the dedicated client provides another lookup on the court's own website.
Access cause lists¶
cause_list returns CauseListPDF records, one per available bench or judge list. Pass causelist_date in DD-MM-YYYY format, bench_code, and civil=True or False. An empty date uses the portal's current-date behaviour.
These are PDF links, not individually parsed hearing entries. Check the document's published date and bench before treating it as the day's board. The district client exposes a different list format.
Advocate workflows¶
case_status_by_advocate supports an advocate name or bar code without a registration-year filter. advocate_search also returns the advocate identity echoed by the portal, helping distinguish an unmatched code from a recognised advocate with no cases. advocate_cause_list returns listing entries for an advocate. Read the client reference for the exact arguments and mutually exclusive inputs.
Command-line equivalents¶
Install the cli extra, then discover identifiers before searching:
bharat-judgements hcservices benches delhi
bharat-judgements hcservices case-types delhi --bench 1
bharat-judgements --json hcservices search-by-party delhi --party tata --year 2024
The current CLI does not expose every SDK method, including live CNR detail and advocate workflows. Use Python for those operations.
When a request fails¶
CAPTCHA failures have finite retries. Confirm the court, bench, case type and year before repeating a lookup. A transport error or parser error is different from a successful empty response. See CAPTCHA solving and request settings.
Next: client API, district courts, or judgment search.