Skip to main content

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

Reason this release was yanked:

important bug fixes

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.0.tar.gz (4.3 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.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pinsearch_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 4.3 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.0.tar.gz
Algorithm Hash digest
SHA256 a357bed5fa971165292bbc45a2e87edaca016bfaf88ddc7ade1971d963a2fb01
MD5 4a087c1344843eed6eb864351dda4c69
BLAKE2b-256 0c7161bf36d7d31e9d1c07cc564ce353702f69b38f3e0dec9db72586a7ccac6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pinsearch_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb7a69ea5a6bc613efa12444ba1bf022b976a9b557e2a59a4b0cb36a451d7c6c
MD5 af9217e0cbdb25bb032a1f7c51422706
BLAKE2b-256 3612e6d5043cb02c372c659a330c37fbb63e1e282ce2dc637021e65c8eb7044d

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