Pythonic pandas wrapper for the official AGMARKNET REST API.
Project description
agmarknet
Python SDK for the official AGMARKNET REST API.
The SDK supports:
- Fetching filter lookup tables.
- Fetching daily price and arrival reports.
- Returning pandas DataFrames.
- Using
requests.Sessionunder the hood. - Resolving commodity, state, district, market, grade, and variety names from the official filters endpoint.
- Exact, case-insensitive, and fuzzy lookup matching.
from agmarknet import Agmarknet
api = Agmarknet()
filters = api.filters()
report = api.report(
from_date="2021-01-01",
to_date="2021-12-31",
commodity="Tomato",
state="Karnataka",
district="Kolar",
market="Bangarpet APMC",
)
Numeric AGMARKNET IDs still work for users who already have them. If group
is omitted, the SDK infers it from the resolved commodity whenever the filters
payload includes the commodity group ID.
api.filters() returns a FilterTables object. You can use attributes,
friendly keys, or raw AGMARKNET keys:
filters = api.filters()
len(filters.commodities)
len(filters["commodities"])
len(filters["cmdt_data"])
Reports automatically fetch all API pages and return one DataFrame.
The default report type is price, matching the live AGMARKNET payload. Use
data_type="arrival" or data_type="both" when needed.
Long historical ranges can be requested with start and end. The SDK splits
the range into yearly chunks, downloads them sequentially, removes duplicate
rows, and preserves chronological order.
history = api.report(
start="2007-01-01",
end="2026-07-08",
commodity="Tomato",
state="Karnataka",
district="Kolar",
market="Bangarpet APMC",
progress=True,
)
Downloads, caching, async support, and CLI features are planned for later roadmap phases.
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
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 agmarknet-0.1.0.tar.gz.
File metadata
- Download URL: agmarknet-0.1.0.tar.gz
- Upload date:
- Size: 28.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
753c2a2bf25b5b356aa3651b76dfabf74328e18e70a12772c4e0704013f7647d
|
|
| MD5 |
2baba3b10395b758720709f0d464e0f0
|
|
| BLAKE2b-256 |
6a29c73a5daa36069f143e5bb8aea5016541d85da65a07e2a9ad58408c14cf5f
|
File details
Details for the file agmarknet-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agmarknet-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
254c20e389e55a01e324921feca5d9138c38b4cc3ff7fb846beab2ffee23609f
|
|
| MD5 |
dc4e42c13327b89a7a32be06f6e5c0f7
|
|
| BLAKE2b-256 |
565b5fe745f88a6c64177a9b4d080616647d01973ef9fdd07566901b877f16be
|