Skip to content

Commit

Permalink
Merge pull request #320 from specklesystems/iain/configurable-certifi…
Browse files Browse the repository at this point in the history
…cate-verification

feat(client): configurable certificate verification
  • Loading branch information
gjedlicska authored Nov 27, 2023
2 parents 4e96aad + 7ad0785 commit ae6fc85
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/specklepy/core/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ class SpeckleClient:

DEFAULT_HOST = "speckle.xyz"
USE_SSL = True

def __init__(self, host: str = DEFAULT_HOST, use_ssl: bool = USE_SSL) -> None:
VERIFY_CERTIFICATE = True

def __init__(
self,
host: str = DEFAULT_HOST,
use_ssl: bool = USE_SSL,
verify_certificate: bool = VERIFY_CERTIFICATE,
) -> None:
ws_protocol = "ws"
http_protocol = "http"

Expand All @@ -74,9 +80,12 @@ def __init__(self, host: str = DEFAULT_HOST, use_ssl: bool = USE_SSL) -> None:
self.graphql = f"{self.url}/graphql"
self.ws_url = f"{ws_protocol}://{host}/graphql"
self.account = Account()
self.verify_certificate = verify_certificate

self.httpclient = Client(
transport=RequestsHTTPTransport(url=self.graphql, verify=True, retries=3)
transport=RequestsHTTPTransport(
url=self.graphql, verify=self.verify_certificate, retries=3
)
)
self.wsclient = None

Expand Down Expand Up @@ -150,7 +159,7 @@ def _set_up_client(self) -> None:
"apollographql-client-version": metrics.HOST_APP_VERSION,
}
httptransport = RequestsHTTPTransport(
url=self.graphql, headers=headers, verify=True, retries=3
url=self.graphql, headers=headers, verify=self.verify_certificate, retries=3
)
wstransport = WebsocketsTransport(
url=self.ws_url,
Expand Down

0 comments on commit ae6fc85

Please sign in to comment.