The `wapi-python` library provides programmatic access to the Volue Insight API (formerly Wattsight API). It allows users to retrieve energy market data, forecasts, and reports. The current version is 0.7.15. It is actively maintained with regular releases, typically multiple times per year, introducing new features and bug fixes.
pip install wapi-pythonVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a session with the Volue Insight API and retrieve a time series by its ID. It highlights the use of environment variables for credentials and shows how to convert the native `WapiSeries` object to a Pandas DataFrame.
Call `.as_pandas()` on the returned `WapiSeries` object to convert it to a DataFrame. Alternatively, you can explicitly configure output using `Session(output_type=PandasDataFrameOutput)`. Example: `my_series.as_pandas()`
Use the unified `session.get_series(...)` method for all time series data retrieval.
Upgrade your Python environment to Python 3.8 or higher. The library is tested against Python 3.8, 3.9, 3.10, and 3.11.
Ensure `WAPI_CLIENT_ID` and `WAPI_CLIENT_SECRET` environment variables are correctly set, or pass `client_id` and `client_secret` directly to the `Session` constructor. Double-check for typos or leading/trailing spaces.
Set the environment variables `WAPI_CLIENT_ID` and `WAPI_CLIENT_SECRET` to your actual credentials, or pass them as arguments to `Session(client_id='your_id', client_secret='your_secret')`.
Use the correct method `my_series.as_pandas()` to convert the `WapiSeries` object to a Pandas DataFrame.
Verify the `series_id` in the Volue Insight portal or documentation. Ensure your API client has access rights to the specific series.
If you need to pass custom headers (e.g., for proxies or specific API versions), use the `proxies` argument for proxy configurations or consult the `wapi-python` documentation for advanced HTTP client configuration, or create a custom `requests.Session` and pass it to `wapi.Session(requests_session=my_requests_session)`.