Skip to content

Commit

Permalink
pass default account for headers when receiving public stream
Browse files Browse the repository at this point in the history
  • Loading branch information
KatKatKateryna committed Dec 7, 2023
1 parent 66251e7 commit 33e4e62
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions speckle/utils/validation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import inspect
from typing import Union
from specklepy.core.api.credentials import get_default_account
from specklepy.core.api.wrapper import StreamWrapper
from specklepy.core.api.models import Stream, Branch, Commit
from specklepy.transports.server import ServerTransport
Expand Down Expand Up @@ -81,7 +82,7 @@ def tryGetClient(sw: StreamWrapper, dataStorage, write=False, dockwidget=None):

def tryGetStream(
sw: StreamWrapper, dataStorage, write=False, dockwidget=None
) -> Stream:
) -> Union[Stream, None]:
try:
# print("tryGetStream")
client, stream = tryGetClient(sw, dataStorage, write, dockwidget)
Expand Down Expand Up @@ -173,7 +174,10 @@ def validateTransport(
client: SpeckleClient, streamId: str
) -> Union[ServerTransport, None]:
try:
transport = ServerTransport(client=client, stream_id=streamId)
account = client.account
if not account.token:
account = get_default_account()
transport = ServerTransport(client=client, account=account, stream_id=streamId)
# print(transport)
return transport
except Exception as e:
Expand Down

0 comments on commit 33e4e62

Please sign in to comment.