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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pinsearch_sdk-0.1.3.tar.gz.
File metadata
- Download URL: pinsearch_sdk-0.1.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90f67d661cf5e324f7a726480a7be014dbfa5dd90ecbdc599d6948329cff0852
|
|
| MD5 |
c9ebe943f8526afae3032aa2a4019ff9
|
|
| BLAKE2b-256 |
778cbacd2c4a91648c0518106ea6028bcaee05e9e554c4b44f58b9e2b46fba10
|
File details
Details for the file pinsearch_sdk-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pinsearch_sdk-0.1.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92ab6c7b3bb03de3854ccb6d66d6b068bae6ea3fd863162af4ec7bf3086ac78a
|
|
| MD5 |
d02f92ee4a687ac0a51d4385a62fe100
|
|
| BLAKE2b-256 |
2f3f3b9ac4bfa622763a4214831fd22f5b8ce64dee959de5bd26ea823f5ef857
|