Serverless, zero-cost, real-time fuel price API for India.
OpenFuel is a "Git Scraping" project that automatically fetches daily petrol and diesel prices from goodreturns.in, cleans the data, and serves it as a static JSON API. It runs entirely on GitHub Actions, providing a high-availability, self-updating database without the need for traditional server infrastructure.
- Daily Updates: Automatically scrapes prices every morning at 06:00 AM IST.
- Cost-Efficiency: Zero operational costs, leveraging GitHub's free tier for compute and storage.
- High Availability: Served via GitHub's global content delivery network (CDN).
- Reliability: Includes fail-safe mechanisms to ensure data integrity and prevent overwrite on failure.
- Developer-Friendly: Standard JSON format with ISO 8601 timestamps for seamless integration.
- Open Data: Publicly accessible and free for all users.
Access the latest fuel prices directly via the raw GitHub URL.
Endpoint:
GET https://raw.githubusercontent.com/SHN2004/OpenFuel/main/prices.json
Response Schema:
{
"last_updated_ist": "2025-12-25T12:34:57.438675+05:30",
"petrol": [
{
"city": "New Delhi",
"price": 94.77
}
],
"diesel": [
{
"city": "New Delhi",
"price": 87.67
}
]
}- Scheduled Execution: A GitHub Actions workflow triggers daily based on a cron schedule.
- Data Extraction: A Python-based scraper fetches current prices from source providers.
- Data Processing: Extracted data is cleaned, normalized, and merged into a structured format.
- Versioned Storage: If changes are detected, the updated dataset is committed to the repository.
Guidelines for setting up the project in a local environment.
- Python 3.11 or higher
- uv (Mandatory for dependency management)
macOS / Linux:
curl -LsSf https://astral.sh/uv/install.sh | shWindows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"For other methods, refer to the official uv documentation.
-
Clone the repository:
git clone https://github.com/SHN2004/OpenFuel.git cd OpenFuel -
Install dependencies:
uv sync
To execute the scraping logic locally:
uv run python src/scraper.pyExecute the test suite using pytest:
uv run pytestWe're actively expanding OpenFuel! Current priorities:
- More Cities - Expand from ~50 to 200+ Indian cities
- CNG/LPG Support - Add more fuel types
- API Versioning - Multiple endpoints, per-city queries
- Documentation - API docs and contributor guides
- Historical Data - Price trends and history
See ROADMAP.md for the full plan.
Contributions are welcome! See CONTRIBUTING.md for the full guide.
Quick start:
- Check open issues for tasks
- Open an issue before starting major work
- Fork, branch, code, test, PR
Top priority: Finding new data sources with more Indian cities.
This project is open-source and available under the MIT License.