Metadata-Version: 2.4
Name: agmarknet
Version: 0.1.0
Summary: Pythonic pandas wrapper for the official AGMARKNET REST API.
Project-URL: Homepage, https://github.com/agmarknet/agmarknet
Project-URL: Issues, https://github.com/agmarknet/agmarknet/issues
Author: Manojkumar Patil
License: MIT License
        
        Copyright (c) 2026 Manojkumar Patil
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: agmarknet,agriculture,arrivals,commodity,prices
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.10
Requires-Dist: pandas>=2.0
Requires-Dist: requests>=2.31
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: responses>=0.25; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Description-Content-Type: text/markdown

# 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.Session` under the hood.
- Resolving commodity, state, district, market, grade, and variety names from
  the official filters endpoint.
- Exact, case-insensitive, and fuzzy lookup matching.

```python
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:

```python
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.

```python
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.
