Skip to content

Commit daead07

Browse files
committed
Remove all cert/tls hacks and update official URL
As we decided to do a hard-switch rather than a smooth one, we are removing all hacks and set it up to work only with the official domain & certificate now. Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 580b041 commit daead07

File tree

4 files changed

+6
-3465
lines changed

4 files changed

+6
-3465
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import asyncio
2828

2929
async def print_dispatches():
3030
# Initialize the client
31-
client = Client(key="your_api_key", server_url="grpc://fz-0004.frequenz.io")
31+
client = Client(key="your_api_key", server_url="grpc://dispatch.eu-1.prod.api.frequenz.com:443")
3232

3333
# List all dispatches for a specific microgrid
3434
async for page in client.list(microgrid_id=1):

src/frequenz/client/dispatch/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from .recurrence import EndCriteria, Frequency, RecurrenceRule, Weekday
3030
from .types import Dispatch, DispatchEvent
3131

32-
DEFAULT_DISPATCH_API_URL = "grpc://fz-0004.frequenz.io:50051"
32+
DEFAULT_DISPATCH_API_URL = "grpc://dispatch.eu-1.prod.api.frequenz.com:443"
3333

3434

3535
def format_datetime(dt: datetime | None) -> str:

src/frequenz/client/dispatch/_client.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
)
5050

5151
# pylint: enable=no-name-in-module
52-
DEFAULT_DISPATCH_PORT = 50051
52+
DEFAULT_DISPATCH_PORT = 443
5353

5454

5555
class DispatchApiClient(BaseApiClient[dispatch_pb2_grpc.MicrogridDispatchServiceStub]):
@@ -75,14 +75,7 @@ def __init__(
7575
connect=connect,
7676
channel_defaults=ChannelOptions(
7777
port=DEFAULT_DISPATCH_PORT,
78-
ssl=SslOptions(
79-
enabled=True,
80-
root_certificates=Path(
81-
str(
82-
files("frequenz.client.dispatch").joinpath("certs/root.crt")
83-
),
84-
),
85-
),
78+
ssl=SslOptions(enabled=True),
8679
),
8780
)
8881
self._metadata = (("key", key),)
@@ -125,7 +118,7 @@ async def list(
125118
Example usage:
126119
127120
```python
128-
client = DispatchApiClient(key="key", server_url="grpc://fz-0004.frequenz.io")
121+
client = DispatchApiClient(key="key", server_url="grpc://dispatch.eu-1.prod.api.frequenz.com:443")
129122
async for page in client.list(microgrid_id=1):
130123
for dispatch in page:
131124
print(dispatch)
@@ -207,7 +200,7 @@ def stream(self, microgrid_id: int) -> channels.Receiver[DispatchEvent]:
207200
Example usage:
208201
209202
```
210-
client = DispatchApiClient(key="key", server_url="grpc://fz-0004.frequenz.io")
203+
client = DispatchApiClient(key="key", server_url="grpc://dispatch.eu-1.prod.api.frequenz.com:443")
211204
async for message in client.stream(microgrid_id=1):
212205
print(message.event, message.dispatch)
213206
```

0 commit comments

Comments
 (0)