Skip to content

savad/pinsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pinsearch

A web API interface for Indian Post office pin directory. We can search post office details by following keyword, the output will be the json data.

  • office_name
  • pin_code
  • office_type
  • delivery_status
  • division
  • region
  • circle
  • taluk
  • district
  • state

Installation guide:

In this project we use,

  • Django
  • django-rest-framework
  • django-heystack
  • pyelasticsearch

Create a virtual environment and activate.

Clone the repository

git clone git@github.com:savad/pinsearch.git

cd pinsearch

pip install -r requirements.txt

setup the database settings at pin/settings.py

Dump pin.sql file to database

Install Elastic search on your machine

For ubuntu ref here https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-elasticsearch-on-ubuntu-14-04

Activate elastic search servie on your machine

python manage.py migrate --noinput

python manage.py collectstatic --noinput

python manage.py rebuild_index

python manage.py runserver

GET : http://localhost:8000/search/?region=Hyderabad


{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "office_name": " Kodad B.O\"",
            "pin_code": 508206,
            "office_type": "B.O",
            "delivery_status": "B.O",
            "division": "Suryapet",
            "region": "Hyderabad",
            "circle": "Andhra Pradesh",
            "taluk": "Huzurnagar",
            "district": "Nalgonda",
            "state": "ANDHRA PRADESH"
        }
    ]
}

GET: http://localhost:8000/search/?circle=Rajasthan&&state=RAJASTHAN

{
    "count": 3,
    "next": null,
    "previous": null,
    "results": [
        {
            "office_name": "12 S.O\"",
            "pin_code": 302017,
            "office_type": "S.O",
            "delivery_status": "S.O",
            "division": "Jaipur City",
            "region": "Jaipur HQ",
            "circle": "Rajasthan",
            "taluk": "Jaipur",
            "district": "Jaipur",
            "state": "RAJASTHAN"
        },
        {
            "office_name": "rajgarh S.O\"",
            "pin_code": 301408,
            "office_type": "S.O",
            "delivery_status": "S.O",
            "division": "Alwar",
            "region": "Jaipur HQ",
            "circle": "Rajasthan",
            "taluk": "Rajgarh",
            "district": "Alwar",
            "state": "RAJASTHAN"
        },
        {
            "office_name": "Bandar Sindari S.O\"",
            "pin_code": 305817,
            "office_type": "S.O",
            "delivery_status": "S.O",
            "division": "Ajmer",
            "region": "Ajmer",
            "circle": "Rajasthan",
            "taluk": "Kishangarh",
            "district": "Ajmer",
            "state": "RAJASTHAN"
        }
    ]
}

About

A web API interface for Indian Post office pin directory search using elasticsearch.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors