Skip to content

Commit 6deb795

Browse files
authored
Update README for API key usage (#64)
Update README with API key usage instructions.
2 parents 9a33bf6 + 27a190e commit 6deb795

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Please also refer to [examples](https://github.com/frequenz-floss/frequenz-clien
3030

3131
```bash
3232
# Choose the version to install
33-
VERSION=0.3.0
33+
VERSION=0.4.0
3434
pip install frequenz-client-reporting==$VERSION
3535
```
3636

@@ -45,7 +45,8 @@ from frequenz.client.reporting import ReportingApiClient
4545

4646
# Change server address
4747
SERVICE_ADDRESS = "localhost:4711"
48-
client = ReportingApiClient(service_address=SERVICE_ADDRESS)
48+
API_KEY = open('api_key.txt').read().strip()
49+
client = ReportingApiClient(service_address=SERVICE_ADDRESS, key=API_KEY)
4950
```
5051

5152
### Query metrics for a single microgrid and component:
@@ -105,5 +106,12 @@ print(df)
105106

106107
The example folder contains a simple client that can be used to query the reporting API from the command line:
107108
```bash
108-
python examples/client.py --url localhost:4711 --mid 42 --cid 23 --metrics AC_ACTIVE_POWER AC_REACTIVE_POWER --start 2024-05-01T00:00:00 --end 2024-05-02T00:00:00
109+
python examples/client.py \
110+
--url localhost:4711 \
111+
--key=$(<api_key.txt)
112+
--mid 42 \
113+
--cid 23 \
114+
--metrics AC_ACTIVE_POWER AC_REACTIVE_POWER \
115+
--start 2024-05-01T00:00:00 \
116+
--end 2024-05-02T00:00:00
109117
```

0 commit comments

Comments
 (0)