Specklepy - Connection to default server speckle.xyz

Hello,

I started using Speckle and I am currently using the provided default server “speckle.xyz”. Creating streams, branches, working with connectors etc works perfectly fine.

From the docs I got that I can use this server for specklepy tasks? I just can seem to make the connection:

from specklepy.api.client import SpeckleClient
from specklepy.api.credentials import get_default_account, get_local_accounts
client = SpeckleClient(host="speckle.xyz")
all_accounts = get_local_accounts()
account = get_default_account()

Returns:
SpeckleClient( server: https://speckle.xyz, authenticated: False )
and an empty list of accounts.

If I click on the link, it opens the normal web viewer. I got the latest version of the Speckle Manager installed and created an api token for my account.

How do I get the connection running?

Thanks in advance!

Hi @GeotBIM,

Glad you’re trying out specklepy!

Looks like you’re missing a few steps - please have a look at the docs as they explain and show how to do all this and more! The very first example shows you how to authenticate and use the client :blush:

https://speckle.guide/dev/py-examples.html

from specklepy.api.client import SpeckleClient
from specklepy.api.credentials import get_default_account

# initialise the client
client = SpeckleClient(host="your-server.com") # or whatever your host is
# client = SpeckleClient(host="localhost:3000", use_ssl=False) or use local server

# authenticate the client with a token
account = get_default_account()
client.authenticate(token=account.token)

If you have any more specific questions, feel free to ask away!

1 Like

Hi @izzylys ,

thanks for the quick answer. I stupidly missed, that my Colab Notebook was not connected to my local runtime. Works perfectly fine now.

2 Likes