@@ -12,31 +12,58 @@ If you're a developer who needs direct access to the [Dispatch API](https://gith
12
12
13
13
## 📦 Installation
14
14
15
+ ### Using pip
16
+
15
17
Install the library via pip:
16
18
17
19
``` bash
18
20
pip install frequenz-client-dispatch
19
21
```
20
22
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
22
42
23
- Here's a quick example to get you started :
43
+ Get up and running in minutes with this simple example :
24
44
25
45
``` python
26
46
from frequenz.client.dispatch import DispatchApiClient
27
47
import asyncio
28
48
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
+ )
32
56
33
- # List all dispatches for a specific microgrid
57
+ # List all dispatches for microgrid ID 1
34
58
async for page in client.list(microgrid_id = 1 ):
35
59
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 (" ---" )
37
64
38
- # Run the Example
39
- asyncio.run(print_dispatches ())
65
+ # Run the example
66
+ asyncio.run(main ())
40
67
```
41
68
42
69
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 ) .
0 commit comments