Retrieve Calcutta High Court orders¶
CalcuttaHCClient queries the court's own website for a case and its published orders. It is a separate source from the national High Court Services portal.
Search and download¶
Install bharat-judgements[ocr] for automatic CAPTCHA input, or use the manual fallback. This example queries WPA 12886 of 2024 on the Appellate Side; it does not assume any number of returned orders or their contents.
import asyncio
from pathlib import Path
from bharat_judgements import CalcuttaHCClient
async def main():
destination = Path("orders")
destination.mkdir(exist_ok=True)
async with CalcuttaHCClient() as client:
case, orders = await client.search_orders(
case_type="12", case_number="12886", year="2024", establishment="appellate"
)
if case is not None:
print(case.case_number, case.cnr_number, case.petitioner, case.respondent)
for index, order in enumerate(orders, start=1):
print(order.order_date, order.order_type, order.pdf_url)
if order.pdf_url:
content = await client.download_order_pdf(order.pdf_url)
(destination / f"order-{index}.pdf").write_bytes(content)
asyncio.run(main())
Use an empty destination folder when rerunning this example to avoid overwriting files from a previous query. The numeric 12 code represents WPA in this example; confirm the code for another case type on the court's search form.
Understand the return value¶
search_orders returns a pair: (CaseInfo | None, list[CaseOrder]). Always unpack both values. A case can have metadata but no published orders. An unmatched case may return (None, []).
Each order can carry its date, type, judge, neutral citation and PDF URL. Do not assume every field or PDF is present. download_order_pdf(url) returns bytes and rejects a response that is not a PDF.
Choose an establishment¶
| Value | Search side |
|---|---|
appellate | Appellate Side |
original | Original Side |
jalpaiguri | Jalpaiguri bench |
portblair | Port Blair bench |
The default is appellate. The client also accepts a raw establishment code; use one only when verified against the portal.
CLI equivalent¶
Add the cli extra for this command:
bharat-judgements --json calcuttahc search --case-type 12 --case-number 12886 --year 2024 --establishment appellate
Add --download orders to save available PDFs. Inspect the returned metadata before using the documents.
Limits and failures¶
This client retrieves the record and PDFs the website exposes; it is not a complete historical index. It does not return a full hearing history. Use HC Services CNR lookup for the richer live case page or the archive for historical judgments.
max_captcha_attempts defaults to five. Each retry uses a fresh session. Empty results, exhausted CAPTCHA attempts and invalid PDF responses are different outcomes; preserve that distinction in your application.
Next: client API, CAPTCHA options, or source coverage.