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.
Metadata
Release files for pinsearch-sdk 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pinsearch_sdk-0.1.4.tar.gz | 616.4 kB | Without provenance | Details for pinsearch_sdk-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pinsearch_sdk-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for pinsearch_sdk-0.1.4-py3-none-any.whl |
Total release size: 1.3 MB
Release files / pinsearch_sdk-0.1.4.tar.gz
| Download URL | pinsearch_sdk-0.1.4.tar.gz |
|---|---|
| Size | 616.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3cc4de272024b8d94dd6d0e5eb12fc824a5eb52df7598d39cf0811a59922461
|
|
BLAKE2b-256 checksum How to use checksums |
72f93d5b08d21a46156483c8925e2396fd29ce60f3d3a7141423d54e7a98167e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pinsearch_sdk-0.1.4-py3-none-any.whl
| Download URL | pinsearch_sdk-0.1.4-py3-none-any.whl |
|---|---|
| Size | 663.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a50fbb4ada512e6df3934899bce232f94943f92ba0b2f5e6baa3d20bc2a02c4
|
|
BLAKE2b-256 checksum How to use checksums |
03e5a3f6eccee676d3cde6644fcd7a08c865648d24bfee16e137e693e94e6844
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for pinsearch-sdk 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.