Metadata-Version: 2.4
Name: mospi-unitdata
Version: 0.1.0
Summary: Python client for downloading data from the MoSPI Microdata Portal (https://microdata.gov.in)
Project-URL: Homepage, https://microdata.gov.in
Project-URL: Repository, https://github.com/nso-india/mospi-unitdata
Project-URL: Issues, https://github.com/nso-india/mospi-unitdata/issues
Author: DIID, Ministry of Statistics and Programme Implementation, Neeraj Prakash, Satvik Bajpai, Sarthak Srivastava
License-Expression: MIT
License-File: LICENSE
Keywords: api,data,government,india,microdata,mospi,nso,nsoindia,statistics
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.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.9
Requires-Dist: requests>=2.31.0
Provides-Extra: dev
Requires-Dist: build>=1.2.2; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Description-Content-Type: text/markdown

# MoSPI Unit Data Client

[![PyPI version](https://badge.fury.io/py/mospi-unitdata.svg)](https://badge.fury.io/py/mospi-unitdata)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A Python client for downloading microdata from the [MoSPI Microdata Portal](https://microdata.gov.in). 
This package provides a convenient interface to browse and download datasets from the Government of India's National Statistical Office (NSO).

### About
This package is used to download the data from the MoSPI Microdata Portal. Specifically, you can browse available datasets interactively and download them by calling the provided methods with your API key.

## Installation

You can install the package directly from PyPI:

```bash
pip install mospi-unitdata
```

## Getting an API Key

To use this package, you need an API key from the MoSPI Microdata Portal:

1.  Visit the [MoSPI Microdata Portal](https://microdata.gov.in).
2.  **Create an account** or sign in if you already have one.
3.  **Verify your email** address (check your inbox for a confirmation link).
4.  **Login** to your account.
5.  Navigate to your **Profile** section.
6.  Click on **Generate API Key** (or view your existing key).

## Usage

To download datasets, use the `getDatasets` method. This method takes two mandatory parameters:
1.  **First parameter (`folderPath`)**: The location/folder on your computer where you want to save the downloaded data.
2.  **Second parameter (`apiKey`)**: Your API key generated from the [MicroData Portal Profile Section](https://microdata.gov.in/NADA/index.php/auth/profile).

```python
from MospiUnitdata import getDatasets

# Provide the save location and your API Key
getDatasets("path/to/save/data", "YOUR_API_KEY")
```

The function provides an interactive prompt to browse through the available datasets:

```text
277:Annual Survey of Industries 2019-20
275:Annual Survey of Industries 2020-21
256:Annual Survey of Industries 2023-24
...
Total pages:13,Page:1 of 13,
Enter Survey index number(put n to Navigate to Next Page): 
```

Type the numeric index to download the associated dataset, or `n` to view the next page.

## Requirements
- Python 3.9+
- `requests` >= 2.31.0


## License

This project is licensed under the MIT License.

