Skip to main content

search Indian postal information by PIN code, state, or district

Project description

pinsearch-sdk

A lightweight Python SDK for searching Indian Postal Index Number (PIN) code data.

pinsearch-sdk provides fast offline access to Indian postal information, including:

  • PIN code lookups
  • State-based searches
  • District-based searches
  • Office information
  • Geographic coordinates (when available)

The SDK ships with a pre-indexed dataset and requires no external API or internet connection.


Installation

pip install pinsearch-sdk

or with uv:

uv add pinsearch-sdk

Quick Start

from pinsearch_sdk import PinSearch

client = PinSearch()

record = client.get("504273")

print(record.officename)
print(record.district)
print(record.statename)

Output:

Karjibheempur B.O
MANCHERIAL
TELANGANA

Lookup by PIN Code

from pinsearch_sdk import PinSearch

client = PinSearch()

record = client.get("504273")

print(record)

Returns:

PincodeData(
    circlename='Telangana Circle',
    regionname='Hyderabad Region',
    divisionname='Adilabad Division',
    officename='Karjibheempur B.O',
    pincode='504273',
    officetype='BO',
    delivery='Delivery',
    district='MANCHERIAL',
    statename='TELANGANA',
    latitude=19.335427,
    longitude=79.4928856
)

If the PIN code does not exist:

record = client.get("000000")

print(record)
None

Search by State

from pinsearch_sdk import PinSearch

client = PinSearch()

for office in client.by_state("TELANGANA"):
    print(office.officename)

The method returns an iterator and yields PincodeData objects lazily.

Convert to a list if needed:

results = list(client.by_state("TELANGANA"))

Search by District

from pinsearch_sdk import PinSearch

client = PinSearch()

for office in client.by_district("MANCHERIAL"):
    print(office.pincode)

Iterate Over the Entire Dataset

from pinsearch_sdk import PinSearch

client = PinSearch()

for office in client:
    print(office.pincode)

Data Model

Every search method returns a PincodeData object.

@dataclass
class PincodeData:
    circlename: str
    regionname: str
    divisionname: str
    officename: str
    pincode: str
    officetype: str
    delivery: str
    district: str
    statename: str
    latitude: float | None
    longitude: float | None

Example

from pinsearch_sdk import PinSearch

client = PinSearch()

record = client.get("504273")

print(record.officename)
print(record.latitude)
print(record.longitude)

Output:

Karjibheempur B.O
19.335427
79.4928856

Performance

  • PIN code lookups are O(1)
  • State searches use pre-built indexes
  • District searches use pre-built indexes
  • Search results are yielded lazily to reduce memory usage

Data Source

The information is derived from publicly available dataset from Open Government Data (OGD) Platform India The data is intended for informational purposes and may not always reflect the latest changes made by India Post.


License

This project is licensed under the MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pinsearch_sdk-0.1.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pinsearch_sdk-0.1.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pinsearch_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: pinsearch_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pinsearch_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 aac00c56960367e6ae8fc59c92195719cb0c02b33aa973032f08d72d59669e00
MD5 b1cb195e44bcaa93c7a332cef825903d
BLAKE2b-256 66f283aa0b312975b960168f907ce4c2729d35f2171d69284920b850397bc221

See more details on using hashes here.

File details

Details for the file pinsearch_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pinsearch_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pinsearch_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1fc39d5043fda113a54b0efe200db27e727e7072afab1baf2a9d80b0a292cb35
MD5 6a192152246b14c31dad58662969cfc7
BLAKE2b-256 812482f78e40c9a7100afc4a9e5e1502d47a77017ba7aab71e9783d52f08164a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page