@@ -12,31 +12,58 @@ If you're a developer who needs direct access to the [Dispatch API](https://gith
1212
1313## 📦 Installation
1414
15+ ### Using pip
16+
1517Install the library via pip:
1618
1719``` bash
1820pip install frequenz-client-dispatch
1921```
2022
21- ## 🛠️ Usage
23+ ### Using Poetry
24+
25+ If you're using Poetry for dependency management:
26+
27+ ``` bash
28+ poetry add frequenz-client-dispatch
29+ ```
30+
31+ ### From Source
32+
33+ To install from source:
34+
35+ ``` bash
36+ git clone https://github.com/frequenz-floss/frequenz-client-dispatch-python.git
37+ cd frequenz-client-dispatch-python
38+ pip install -e .
39+ ```
40+
41+ ## 🚀 Quick Start
2242
23- Here's a quick example to get you started :
43+ Get up and running in minutes with this simple example :
2444
2545``` python
2646from frequenz.client.dispatch import DispatchApiClient
2747import asyncio
2848
29- async def print_dispatches ():
30- # Initialize the client
31- client = DispatchApiClient(key = " your_api_key" , server_url = " grpc://dispatch.url.goes.here.example.com" )
49+ async def main ():
50+ # Initialize the client with your API credentials
51+ client = DispatchApiClient(
52+ auth_key = " your_auth_key_here" ,
53+ sign_secret = " your_sign_secret_here" ,
54+ server_url = " grpc://dispatch.url.goes.here.example.com"
55+ )
3256
33- # List all dispatches for a specific microgrid
57+ # List all dispatches for microgrid ID 1
3458 async for page in client.list(microgrid_id = 1 ):
3559 for dispatch in page:
36- print (dispatch)
60+ print (f " Dispatch ID: { dispatch.id} " )
61+ print (f " Type: { dispatch.type} " )
62+ print (f " Start Time: { dispatch.start_time} " )
63+ print (" ---" )
3764
38- # Run the Example
39- asyncio.run(print_dispatches ())
65+ # Run the example
66+ asyncio.run(main ())
4067```
4168
4269For 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 ) .
0 commit comments