Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 36 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,58 @@ If you're a developer who needs direct access to the [Dispatch API](https://gith

## 📦 Installation

### Using pip

Install the library via pip:

```bash
pip install frequenz-client-dispatch
```

## 🛠️ Usage
### Using Poetry

If you're using Poetry for dependency management:

```bash
poetry add frequenz-client-dispatch
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would skip this, otherwise we need to include also uv, conda, pipenv, pdm, etc.


### From Source

To install from source:

```bash
git clone https://github.com/frequenz-floss/frequenz-client-dispatch-python.git
cd frequenz-client-dispatch-python
pip install -e .
```
Comment on lines +31 to +39
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also overlaps with the contributing guide, installing in editable mode just to install for use also feels wrong.


## 🚀 Quick Start

Here's a quick example to get you started:
Get up and running in minutes with this simple example:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumping up the marketing? 😆


```python
from frequenz.client.dispatch import DispatchApiClient
import asyncio

async def print_dispatches():
# Initialize the client
client = DispatchApiClient(key="your_api_key", server_url="grpc://dispatch.url.goes.here.example.com")
async def main():
# Initialize the client with your API credentials
client = DispatchApiClient(
auth_key="your_auth_key_here",
sign_secret="your_sign_secret_here",
server_url="grpc://dispatch.url.goes.here.example.com"
)

# List all dispatches for a specific microgrid
# List all dispatches for microgrid ID 1
async for page in client.list(microgrid_id=1):
for dispatch in page:
print(dispatch)
print(f"Dispatch ID: {dispatch.id}")
print(f"Type: {dispatch.type}")
print(f"Start Time: {dispatch.start_time}")
print("---")

# Run the Example
asyncio.run(print_dispatches())
# Run the example
asyncio.run(main())
```

For detailed usage and advanced features, check out the [client documentation](https://frequenz-floss.github.io/frequenz-client-dispatch-python/latest/reference/frequenz/client/dispatch/#frequenz.client.dispatch.ApiDispatchClient).
Expand Down