FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use common API credential variables in examples by Marenz · Pull Request #240 · frequenz-floss/frequenz-dispatch-python · GitHub

Repository navigation

Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .md  (2) .py  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 4 additions & 4 deletions README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ from frequenz.dispatch import Created, Deleted, Dispatcher, Updated

async def main() -> None:
url = os.getenv("DISPATCH_API_URL", "grpc://localhost:50051")
auth_key = os.getenv("DISPATCH_API_AUTH_KEY", "my-api-key")
sign_secret = os.getenv("DISPATCH_API_SIGN_SECRET")
auth_key = os.getenv("FREQUENZ_API_KEY", "my-api-key")
sign_secret = os.getenv("FREQUENZ_API_SECRET")
microgrid_id = 1

async with Dispatcher(
Expand Down Expand Up @@ -118,8 +118,8 @@ async def run() -> None:
url = os.getenv(
"DISPATCH_API_URL", "grpc://dispatch.api.example.com:50051"
)
auth_key = os.getenv("DISPATCH_API_AUTH_KEY", "my-api-key")
sign_secret = os.getenv("DISPATCH_API_SIGN_SECRET")
auth_key = os.getenv("FREQUENZ_API_KEY", "my-api-key")
sign_secret = os.getenv("FREQUENZ_API_SECRET")

microgrid_id = 1

Expand Down
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->

- Credential examples now use `FREQUENZ_API_KEY` and `FREQUENZ_API_SECRET`.

## New Features

<!-- Here goes the main new features and examples or instructions on how to use them -->
Expand Down
4 changes: 2 additions & 2 deletions src/frequenz/dispatch/_actor_dispatcher.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ def _update_dispatch_information(self, dispatch_update: DispatchInfo) -> None:

async def main():
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
auth_key = os.getenv("DISPATCH_API_AUTH_KEY", "some-key")
sign_secret = os.getenv("DISPATCH_API_SIGN_SECRET")
auth_key = os.getenv("FREQUENZ_API_KEY", "some-key")
sign_secret = os.getenv("FREQUENZ_API_SECRET")

microgrid_id = 1

Expand Down
16 changes: 8 additions & 8 deletions src/frequenz/dispatch/_dispatcher.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ async def create_actor(dispatch: DispatchInfo, receiver: Receiver[DispatchInfo])

async def run():
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
key = os.getenv("DISPATCH_API_KEY", "some-key")
auth_key = os.getenv("FREQUENZ_API_KEY", "some-key")

microgrid_id = 1

async with Dispatcher(
microgrid_id=microgrid_id,
server_url=url,
auth_key=key
auth_key=auth_key
) as dispatcher:
await dispatcher.start_managing(
dispatch_type="DISPATCH_TYPE",
Expand All @@ -85,14 +85,14 @@ async def run():

async def run():
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
key = os.getenv("DISPATCH_API_KEY", "some-key")
auth_key = os.getenv("FREQUENZ_API_KEY", "some-key")

microgrid_id = 1

async with Dispatcher(
microgrid_id=microgrid_id,
server_url=url,
auth_key=key
auth_key=auth_key
) as dispatcher:
actor = MagicMock() # replace with your actor

Expand Down Expand Up @@ -130,14 +130,14 @@ async def run():

async def run():
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
key = os.getenv("DISPATCH_API_KEY", "some-key")
auth_key = os.getenv("FREQUENZ_API_KEY", "some-key")

microgrid_id = 1

async with Dispatcher(
microgrid_id=microgrid_id,
server_url=url,
auth_key=key,
auth_key=auth_key,
) as dispatcher:
events_receiver = dispatcher.new_lifecycle_events_receiver("DISPATCH_TYPE")

Expand Down Expand Up @@ -167,14 +167,14 @@ async def run():

async def run():
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
key = os.getenv("DISPATCH_API_KEY", "some-key")
auth_key = os.getenv("FREQUENZ_API_KEY", "some-key")

microgrid_id = 1

async with Dispatcher(
microgrid_id=microgrid_id,
server_url=url,
auth_key=key,
auth_key=auth_key,
) as dispatcher:
# Create a new dispatch
new_dispatch = await dispatcher.client.create(
Expand Down

Back | FazBrowse Home | New Git URL