Metadata-Version: 2.5
Name: phisaver-client
Version: 2.1.1
Summary: A client library for accessing Phisaver API
Project-URL: Homepage, https://github.com/phisaver/phisaver-client
Project-URL: Repository, https://github.com/phisaver/phisaver-client
Author-email: Brett Beeson <brett@phisaver.com>
License: MIT
License-File: LICENSE
Keywords: api,client,openapi,phisaver
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.12
Requires-Dist: attrs>=22.2.0
Requires-Dist: httpx>=0.28.1
Requires-Dist: python-dateutil>=2.8.0
Provides-Extra: dev
Requires-Dist: openapi-python-client>=0.26.2; extra == 'dev'
Requires-Dist: pytest>=8.4.2; extra == 'dev'
Description-Content-Type: text/markdown

This package provides a client for the PhiSaver API. It is auto-generated using OpenAPI specifications from that API. 


## Install

```bash
pip install phisaver-client
```

Version 2.x targets the PhiSaver v2 API (`/api/v2/`).

## Quick start

<!-- llm: minimal usage for the PyPI page; full examples live in phisaver-api-demo -->
```python
from phisaver_client.api.sites.sites_list import sync as get_sites
from phisaver_client.api.ts.ts_series_retrieve import sync_detailed as get_series
from phisaver_client.helpers import get_client_from_env

client = get_client_from_env()  # reads PS_API_URL, PS_API_USERNAME, PS_API_PASSWORD

sites = get_sites(client=client)
series = get_series(
    client=client,
    sites=sites[0].id,
    duration="7d",            # the last 7 days
    bin_="1d",
    mets="Production,Net",    # one comma-separated string, not a list
    units="kWh/day",
)
print(series.parsed.to_dict())
```

See [USAGE_EXAMPLES.md](USAGE_EXAMPLES.md) and <https://github.com/phisaver/phisaver-api-demo> for more.


<!-- ## Usage
```
import phisaver_client 

For testing from Test PyPI:
```bash
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ phisaver-client
```



``` -->

## Documentation

The documentation for the client can be found at: https://github.com/phisaver/phisaver-client

## Testing

The default suite is isolated from the PhiSaver server and uses mocked HTTP:

```bash
uv run pytest
```

The live contract tests treat PhiSaver as an external service. Prepare the
test service from the server project, then run them explicitly from the client
project:

```bash
cd ../server
uv run python manage.py mock_data

cd ../client
uv run pytest -m live
```

Live tests read `PS_API_URL`, `PS_API_USERNAME`, and `PS_API_PASSWORD` from
the process environment. If any are absent, the live suite is skipped. Store
host-managed credentials in `/etc/phisaver/phisaver-api.env`; the repository
`.envrc` loads that file for interactive commands. Automated tests use the
separate committed fake configuration under `testing/`.

To remove the old repository-local credential file from Git while retaining
your local copy, run:

```bash
git rm --cached client/phisaverapi.env
```
