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.2.tar.gz (629.5 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.2-py3-none-any.whl (677.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pinsearch_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 629.5 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.2.tar.gz
Algorithm Hash digest
SHA256 6de78f8789362911c0098d28c7f1af4b3ca15e9e7a02a62c3e6bc5b33b30a06d
MD5 4f2aa18311d999dfd9bf44648dfd5299
BLAKE2b-256 5d204327168393e83012e446075e822d52f32f35e5c6b3c150e3a1fa37c544dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pinsearch_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 677.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c635b9645cbc448945110d2f476ebb7dd9a5045a7e3f8fd80dcc9b87d605d08d
MD5 1c2cad6e07c3664dc9ad4885dc9e3675
BLAKE2b-256 26ba2c7dcb6beb521c94277cf8be7fa4f8ca8d5157c76964680339ecbe297756

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