Download gst_api.py from ACA050/ReconAI: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/spaces/ACA050/ReconAI/resolve/main/gst_api.py
- Command line
-
hf download hf://spaces/ACA050/ReconAI/gst_api.py
-
curl -L -o gst_api.py https://huggingface.co/spaces/ACA050/ReconAI/resolve/main/gst_api.py
1.09 kB
| import time | |
| import pandas as pd | |
| import logging | |
| logging.basicConfig(level=logging.INFO) | |
| logger = logging.getLogger(__name__) | |
| class GSTGatewayMock: | |
| """ | |
| Mocks a real-time fetching from live GST sites. | |
| In a real scenario, this would use requests to hit a government API endpoint. | |
| """ | |
| def __init__(self): | |
| self.api_url = "https://mock-gst-api.gov.in/v1/returns" | |
| def fetch_gst_data(self, start_date, end_date, gstin="27AADCB2230M1Z2"): | |
| logger.info(f"Simulating fetch from {self.api_url} for GSTIN {gstin}") | |
| # Simulate network latency | |
| time.sleep(2) | |
| # Generate an empty DataFrame to represent no live data without credentials | |
| # (This prevents injecting fake/dummy data into the user's analysis) | |
| logger.info("Live GST API requires production credentials. Returning empty dataset.") | |
| return pd.DataFrame(columns=['InvoiceID', 'VendorName', 'Amount', 'InvoiceDate', 'GSTIN']) | |
| def validate_gstin(self, gstin): | |
| """Mock GSTIN validation""" | |
| time.sleep(0.5) | |
| return len(gstin) == 15 | |