Metadata-Version: 2.4
Name: pydelhidoris
Version: 0.1.1
Summary: Unofficial Python wrapper for Delhi DORIS eSearch Portal
Author: Raghav Sachdev
License-Expression: MIT
Keywords: doris,delhi,property,esearch,government,wrapper
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: beautifulsoup4
Dynamic: license-file

![Python](https://img.shields.io/badge/Python-3.10%2B-blue)
![FastAPI](https://img.shields.io/badge/FastAPI-Latest-green)
![License](https://img.shields.io/badge/License-MIT-yellow)

# DORIS API

Unofficial FastAPI wrapper for the Delhi Government eSearch Property Portal.

This API simplifies interaction with the DORIS/eSearch portal by providing clean JSON endpoints for:

- Property Address Suggestions
- Captcha Retrieval
- Property Search
- Easy Integration with Next.js, React, Node.js and other applications

---

## Features

- FastAPI Powered
- Address Autocomplete Suggestions
- Captcha Session Handling
- Property Search Records
- JSON Responses
- Frontend Friendly
- Open Source

---

## Disclaimer

This project is not affiliated with, endorsed by, or associated with the Government of NCT of Delhi.

Data is retrieved from publicly accessible services provided by the Delhi eSearch Portal.

This project is intended for educational, research, and integration purposes only.

---

## Base URL

### Local Development

```bash
http://localhost:8000
```

## Installation

Clone the repository:

```bash
git clone https://github.com/raghavsach-dev/DORIS-API.git
cd DORIS-API
```

Install dependencies:

```bash
pip install -r requirements.txt
```

Run the server:

```bash
uvicorn app:app --reload
```

Open Swagger Docs:

```bash
http://localhost:8000/docs
```

---

## API Endpoints

### 1. Get Address Suggestions

Returns matching property addresses.

#### Request

```http
GET /suggest?q=jagri
```

#### Response

```json
{
  "success": true,
  "results": [
    "305 JAGRITI ENCLAVE",
    "335 JAGRITI ENCLAVE DELHI JAGRATI ENCLAVE"
  ]
}
```

---

### 2. Create Search Session & Fetch Captcha

Creates a new session and returns a captcha image URL.

#### Request

```http
GET /captcha
```

#### Response

```json
{
  "success": true,
  "session_id": "uuid",
  "image_url": "/captcha-image/uuid"
}
```

---

### 3. Get Captcha Image

Returns the captcha image associated with a session.

#### Request

```http
GET /captcha-image/{session_id}
```

Example:

```http
GET /captcha-image/uuid
```

---

### 4. Search Property Records

Searches property records using a selected address and captcha.

#### Request

```http
POST /search
```

#### Body

```json
{
  "session_id": "uuid",
  "address": "335 JAGRITI ENCLAVE DELHI JAGRATI ENCLAVE",
  "captcha": "R4R93N"
}
```

#### Response

```json
{
  "success": true,
  "count": 1,
  "records": [
    {
      "reg_no": "102",
      "reg_date": "11-03-2013",
      "first_party": "Dev Raj",
      "second_party": "Veena Nijhawan, Tina Nijhawan",
      "property_address": "House No. 335 Jagriti Enclave Delhi,Jagrati Enclave",
      "deed_type": "SALE,SALE WITHIN MC AREA",
      "property_type": "Residential",
      "sro_name": "SR IVb Vivek Vihar"
    }
  ]
}
```

---

## Typical Workflow

1. User starts typing a property address
2. Call `/suggest`
3. User selects an address from suggestions
4. Call `/captcha`
5. Display the captcha image
6. User enters the captcha
7. Call `/search`
8. Display property records

---

## Next.js Example

### Fetch Suggestions

```javascript
const res = await fetch(
  `${API_URL}/suggest?q=jagri`
);

const data = await res.json();
```

### Fetch Captcha

```javascript
const captchaRes = await fetch(
  `${API_URL}/captcha`
);

const captchaData = await captchaRes.json();

setSessionId(captchaData.session_id);

const imageUrl =
  `${API_URL}${captchaData.image_url}`;
```

Render:

```jsx
<img src={imageUrl} alt="captcha" />
```

### Search Records

```javascript
const res = await fetch(
  `${API_URL}/search`,
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      session_id,
      address,
      captcha
    })
  }
);

const data = await res.json();
```

Render Results:

```jsx
{data.records.map((record) => (
  <div key={record.reg_no}>
    <h3>{record.first_party}</h3>
    <p>{record.second_party}</p>
    <p>{record.reg_date}</p>
  </div>
))}
```

---

## Tech Stack

- Python
- FastAPI
- Requests
- BeautifulSoup4
- Uvicorn

---

## Contributing

Contributions, improvements, bug reports, and feature requests are welcome.

Feel free to open an issue or submit a pull request.

---

## License

MIT License

---

Built to make integration with the Delhi eSearch portal simpler for developers who would rather work with JSON than wrestle with legacy ASP.NET forms and hidden fields. Humanity keeps inventing beautiful APIs and then hiding critical data behind WebForms from 2008. This project attempts to restore balance.
