Recieving a stream from Speckle project & Sending it via Jupyter

Hi I am trying to receive a stream from a project in Speckle and sending it to another project using SpecklePy Jupyter. I can recieve the object successfully but cant send it to another project. I get a HTTPError: 401 Client Error: Unauthorized for url:

Here is my code :


# Define global variables

HOST = "https://latest.speckle.systems/"
AUTHENTICATION_TOKEN = "MY_TOKEN"
STREAM_ID = "RECIEVE_ID"


# Setting up SpeckleClient and authenticating

client = SpeckleClient(host=HOST)

client.authenticate_with_token(token=AUTHENTICATION_TOKEN)

# Receving commit

transport = ServerTransport(STREAM_ID, client)

model_data = operations.receive (obj_id= "Obj_ID ",remote_transport=transport)

# Define the destination stream ID

destination_stream_id = "STREAM_ID"

# Set up the transport for the destination stream

transport_sender = ServerTransport(client=client, stream_id=destination_stream_id)

# Send the object to the Speckle server

hash = operations.send(base=model_data, transports=[transport_sender])

How are you generating your auth token?

From your profile, under the Developer tab, you should be able to add a new Access Token.

You’ll also need to ensure the token has the required scopes. You may simply want to select all of them.

1 Like

I generated the access token with all the permissions. The Authentication seems to be working as I can receive the objects successfully. But Unfortunately when I send it gives me the error @Jedd

The stream/project id you’re trying to send to.

Is this a project that you’ve created? or are you added as a collaborator/reviewer?

Its a project I created

Hey, I’ve just run your code locally.

Looks to be working fine.

Maybe you could share with me a link to the destination stream that you’re trying to send to?

1 Like

This is the stream I am trying to send to
https://latest.speckle.systems/projects/6d78e1d32c

Are you sure you generated your auth token on latest.speckle.systems and not app.speckle.systems or another server?

If you call client.active_user.get(); and still see an error, then there is a problem with your auth token and I suggest you regenerate it.

1 Like