Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f7113f0c5 | |||
| 7f38b24421 | |||
| cac4551fdf | |||
| 813bc8be4d | |||
| a45ae03235 | |||
| 905377dea1 | |||
| 62c5114cb3 | |||
| 43a5302a90 | |||
| addaa996ea |
@@ -1,5 +1,5 @@
|
||||
"""This module contains an SDK for working with Speckle Automate."""
|
||||
from speckle_automate import fixtures
|
||||
|
||||
from speckle_automate.automation_context import AutomationContext
|
||||
from speckle_automate.runner import execute_automate_function, run_function
|
||||
from speckle_automate.schema import (
|
||||
@@ -21,5 +21,4 @@ __all__ = [
|
||||
"ObjectResultLevel",
|
||||
"run_function",
|
||||
"execute_automate_function",
|
||||
"fixtures",
|
||||
]
|
||||
|
||||
@@ -21,7 +21,7 @@ class SpeckleClient(CoreSpeckleClient):
|
||||
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 `speckle.xyz`.
|
||||
or you can use our public server `app.speckle.systems`.
|
||||
|
||||
To authenticate the client, you'll need to have downloaded
|
||||
the [Speckle Manager](https://speckle.guide/#speckle-manager)
|
||||
@@ -32,7 +32,7 @@ class SpeckleClient(CoreSpeckleClient):
|
||||
from specklepy.api.credentials import get_default_account
|
||||
|
||||
# initialise the client
|
||||
client = SpeckleClient(host="speckle.xyz") # or whatever your host is
|
||||
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)
|
||||
@@ -47,7 +47,7 @@ class SpeckleClient(CoreSpeckleClient):
|
||||
```
|
||||
"""
|
||||
|
||||
DEFAULT_HOST = "speckle.xyz"
|
||||
DEFAULT_HOST = "app.speckle.systems"
|
||||
USE_SSL = True
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -22,7 +22,7 @@ class StreamWrapper(CoreStreamWrapper):
|
||||
from specklepy.api.wrapper import StreamWrapper
|
||||
|
||||
# provide any stream, branch, commit, object, or globals url
|
||||
wrapper = StreamWrapper("https://speckle.xyz/streams/3073b96e86/commits/604bea8cc6")
|
||||
wrapper = StreamWrapper("https://app.speckle.systems/streams/3073b96e86/commits/604bea8cc6")
|
||||
|
||||
# get an authenticated SpeckleClient if you have a local account for the server
|
||||
client = wrapper.get_client()
|
||||
|
||||
@@ -30,7 +30,7 @@ class SpeckleClient:
|
||||
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 `speckle.xyz`.
|
||||
or you can use our public server `app.speckle.systems`.
|
||||
|
||||
To authenticate the client, you'll need to have downloaded
|
||||
the [Speckle Manager](https://speckle.guide/#speckle-manager)
|
||||
@@ -41,7 +41,7 @@ class SpeckleClient:
|
||||
from specklepy.api.credentials import get_default_account
|
||||
|
||||
# initialise the client
|
||||
client = SpeckleClient(host="speckle.xyz") # or whatever your host is
|
||||
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)
|
||||
@@ -56,7 +56,7 @@ class SpeckleClient:
|
||||
```
|
||||
"""
|
||||
|
||||
DEFAULT_HOST = "speckle.xyz"
|
||||
DEFAULT_HOST = "app.speckle.systems"
|
||||
USE_SSL = True
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -58,7 +58,7 @@ def get_local_accounts(base_path: Optional[str] = None) -> List[Account]:
|
||||
res = account_storage.get_all_objects()
|
||||
account_storage.close()
|
||||
if res:
|
||||
accounts.extend(Account.model_validate_json(r[1]) for r in res)
|
||||
accounts.extend(Account.parse_raw(r[1]) for r in res)
|
||||
except SpeckleException:
|
||||
# cannot open SQLiteTransport, probably because of the lack
|
||||
# of disk write permissions
|
||||
@@ -79,7 +79,7 @@ def get_local_accounts(base_path: Optional[str] = None) -> List[Account]:
|
||||
if json_acct_files:
|
||||
try:
|
||||
accounts.extend(
|
||||
Account.model_validate_json(Path(json_path, json_file).read_text())
|
||||
Account.parse_raw(Path(json_path, json_file).read_text())
|
||||
# Account.parse_file(os.path.join(json_path, json_file))
|
||||
for json_file in json_acct_files
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ class StreamWrapper:
|
||||
from specklepy.api.wrapper import StreamWrapper
|
||||
|
||||
# provide any stream, branch, commit, object, or globals url
|
||||
wrapper = StreamWrapper("https://speckle.xyz/streams/3073b96e86/commits/604bea8cc6")
|
||||
wrapper = StreamWrapper("https://app.speckle.systems/streams/3073b96e86/commits/604bea8cc6")
|
||||
|
||||
# get an authenticated SpeckleClient if you have a local account for the server
|
||||
client = wrapper.get_client()
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from specklepy.objects.base import Base
|
||||
|
||||
|
||||
class GisFeature(
|
||||
Base, speckle_type="Objects.GIS.GisFeature", detachable={"displayValue"}
|
||||
):
|
||||
"""GIS Feature"""
|
||||
|
||||
geometry: Optional[List[Base]] = None
|
||||
attributes: Base
|
||||
displayValue: Optional[List[Base]] = None
|
||||
@@ -23,7 +23,7 @@ def host():
|
||||
def seed_user(host):
|
||||
seed = uuid.uuid4().hex
|
||||
user_dict = {
|
||||
"email": f"{seed[0:7]}@spockle.com",
|
||||
"email": f"{seed[0:7]}@example.org",
|
||||
"password": "$uper$3cr3tP@ss",
|
||||
"name": f"{seed[0:7]} Name",
|
||||
"company": "test spockle",
|
||||
|
||||
@@ -183,7 +183,7 @@ class TestStream:
|
||||
# NOTE: only works for server admins
|
||||
# invited = client.stream.invite_batch(
|
||||
# stream_id=stream.id,
|
||||
# emails=["userA@speckle.xyz", "userB@speckle.xyz"],
|
||||
# emails=["userA@example.org", "userB@example.org"],
|
||||
# user_ids=[second_user.id],
|
||||
# message="yeehaw 🤠",
|
||||
# )
|
||||
@@ -192,7 +192,7 @@ class TestStream:
|
||||
|
||||
# invited_only_email = client.stream.invite_batch(
|
||||
# stream_id=stream.id,
|
||||
# emails=["userC@speckle.xyz"],
|
||||
# emails=["userC@example.org"],
|
||||
# message="yeehaw 🤠",
|
||||
# )
|
||||
|
||||
|
||||
@@ -100,16 +100,20 @@ def test_parse_globals_as_commit():
|
||||
|
||||
|
||||
#! NOTE: the following three tests may not pass locally
|
||||
# if you have a `speckle.xyz` account in manager
|
||||
# if you have a `app.speckle.systems` account in manager
|
||||
def test_get_client_without_auth():
|
||||
wrap = StreamWrapper("https://speckle.xyz/streams/4c3ce1459c/commits/8b9b831792")
|
||||
wrap = StreamWrapper(
|
||||
"https://app.speckle.systems/streams/4c3ce1459c/commits/8b9b831792"
|
||||
)
|
||||
client = wrap.get_client()
|
||||
|
||||
assert client is not None
|
||||
|
||||
|
||||
def test_get_new_client_with_token(user_path):
|
||||
wrap = StreamWrapper("https://speckle.xyz/streams/4c3ce1459c/commits/8b9b831792")
|
||||
wrap = StreamWrapper(
|
||||
"https://app.speckle.systems/streams/4c3ce1459c/commits/8b9b831792"
|
||||
)
|
||||
client = wrap.get_client()
|
||||
client = wrap.get_client(token="super-secret-token")
|
||||
|
||||
@@ -117,7 +121,9 @@ def test_get_new_client_with_token(user_path):
|
||||
|
||||
|
||||
def test_get_transport_with_token():
|
||||
wrap = StreamWrapper("https://speckle.xyz/streams/4c3ce1459c/commits/8b9b831792")
|
||||
wrap = StreamWrapper(
|
||||
"https://app.speckle.systems/streams/4c3ce1459c/commits/8b9b831792"
|
||||
)
|
||||
client = wrap.get_client()
|
||||
assert not client.account.token # unauthenticated bc no local accounts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user