-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forward existing Authencation headers
- Loading branch information
1 parent
f3767e1
commit e9406e5
Showing
4 changed files
with
55 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from bluesky.callbacks.tiled_writer import TiledWriter | ||
from httpx import Headers | ||
from tiled.client import from_context | ||
from tiled.client.context import Context as TiledContext | ||
|
||
from blueapi.config import TiledConfig | ||
from blueapi.core.bluesky_types import DataEvent | ||
|
||
|
||
class TiledConverter: | ||
def __init__(self, tiled_context: TiledContext): | ||
self._writer: TiledWriter = TiledWriter(from_context(tiled_context)) | ||
|
||
def __call__(self, data: DataEvent, _: str | None = None) -> None: | ||
self._writer(data.name, data.doc) | ||
|
||
|
||
class TiledConnection: | ||
def __init__(self, config: TiledConfig): | ||
self.uri = f"{config.host}:{config.port}" | ||
|
||
def __call__(self, headers: Headers | None): | ||
return TiledConverter(TiledContext(self.uri, headers=headers)) |