Client
The SpeckleClient is your entry point for interacting with
your Speckle Server's GraphQL API.
You'll need to have access to a server to use it,
or you can use our public server app.speckle.systems.
To authenticate the client, you'll need to have downloaded the Speckle Manager and added your account.
from specklepy.api.client import SpeckleClient
from specklepy.core.api.inputs.project_inputs import ProjectCreateInput
from specklepy.api.credentials import get_default_account
# initialise the client
client = SpeckleClient(host="app.speckle.systems") # or whatever your host is
# client = SpeckleClient(host="localhost:3000", use_ssl=False) or use local server
# authenticate the client with an account
# (account has been added in Speckle Manager)
account = get_default_account()
client.authenticate_with_account(account)
# create a new project
input = ProjectCreateInput(name="a shiny new project")
project = self.project.create(input)
# or, use a project id to get an existing project from the server
new_stream = client.project.get("abcdefghij")
Source code in src/specklepy/api/client.py
authenticate_with_token
authenticate_with_token(token: str) -> None
Authenticate the client using a personal access token. The token is saved in the client object and a synchronous GraphQL entrypoint is created
Source code in src/specklepy/api/client.py
authenticate_with_account
authenticate_with_account(account: Account) -> None
Authenticate the client using an Account object The account is saved in the client object and a synchronous GraphQL entrypoint is created