Choose a Supreme Court source¶
Use the live SCIClient for the homepage's recent judgments and orders. Use the archive for historical structured research, or the judgment portal for SCR text search.
Read the recent feed¶
The following complete example reads five entries and downloads the first available PDF. It needs network access but no CAPTCHA.
import asyncio
from pathlib import Path
from bharat_judgements import SCIClient
async def main():
async with SCIClient() as client:
records = await client.list_recent_judgments(limit=5)
for record in records:
print(record.judgment_date, record.case_number, record.title)
if records and records[0].pdf_url:
record = await client.download_pdf(records[0])
if record.pdf_bytes is not None:
Path("recent-sci.pdf").write_bytes(record.pdf_bytes)
asyncio.run(main())
The output file is overwritten if it exists. This is the feed exposed on www.sci.gov.in, capped by the homepage's available items, typically up to 50. It is not a complete list of judgments delivered during a requested period.
Know the unsupported methods¶
SCIClient.search_by_year and search_by_party raise NotImplementedError. The current client does not implement the court website's case-number or diary-number search forms.
For older records, use archive queries with court="sci". For full-text search of Supreme Court Reports, use JudgmentSearchClient with court_type="3". The facade's default text search uses High Courts, so it is not a replacement for that explicit SCR query.
Download behaviour¶
SCIClient.download_pdf(record) retrieves the viewer's PDF URL, verifies the PDF header, sets pdf_bytes on the supplied JudgmentResult and returns it. Missing URLs and non-PDF responses raise errors.
Live feed downloads and archive downloads use different mechanisms. The first archive PDF for a year may require a large tar download; a live feed PDF is fetched through the website.
CLI examples¶
With the cli extra installed:
bharat-judgements --json sci recent --limit 5
bharat-judgements sci recent --limit 5 --download recent-orders
bharat-judgements --json archive query --court sci --year 2020 --limit 10
These are query examples, not promises of a particular result count. Check document dates, identifiers and the source before comparing records.
Next: client reference, archive retrieval, or sources.