Skip to main content

SDK to communicate with the ShapeDiver Geometry API version 2

Project description

Project generated with PyScaffold

geometry_api_v2

SDK to communicate with the ShapeDiver Geometry API version 2

ShapeDiver is a cloud platform for building online applications based on parametric 3D files made with Rhinoceros 3D and Grasshopper.

Using the ShapeDiver Geometry Backend API allows access to ShapeDiver models without using the ShapeDiver Viewer. This SDK provides functionality to communicate with the Geometry Backend API version 2, and includes type hints describing request and response data objects. See the API documentation for more details.

Authentication

The authentication system for the Geometry Backend API is based on ticket objects and JWT tokens, which are handled by the ShapeDiver Platform. You can obtain tickets and JWT tokens by:

An SDK for the ShapeDiver Platform API will be released soon.

When obtaining a ticket for your model from the ShapeDiver Platform, please be aware that you will need a ticket for backend access, since you are accessing the Geometry Backend API from an arbitrary client application that is not a web browser. For more details see the ShapeDiver Help Center developer settings

Base URL

The base URL to use depends on which ShapeDiver Geometry Backend System your model was uploaded to. You can find the base URL in your model’s dashboard on the ShapeDiver Platform, it is also called the model view url.

Usage - Ticket only

from shapediver.geometry_api_v2.client import Configuration, SessionApi
from shapediver.geometry_api_v2.sd_client import SdClient

def init_session():
    # Please see above on how to obtain a ticket
    ticket = "8b23fae66cf535719a9ec797e390208b2003e3cfc894b7624ada2f6894515f8836a4-66303337623538322d34386"

    # Initialize the SDK client instance by providing the base URL
    client = SdClient(Configuration("https://sdeuc1.eu-central-1.shapediver.com"))

    # Initialize a new session using the ticket.
    res = SessionApi(client).create_session_by_ticket(ticket)
    print(res)

Usage - Ticket and JWT

It is possible to configure your ShapeDiver models such that JWT tokens are required to communicate with them, which provides a strong authorisation mechanism. In this case you will need to use the ShapeDiver Platform API to obtain a JWT token for your model on demand.:

from shapediver.geometry_api_v2.client import Configuration, SessionApi
from shapediver.geometry_api_v2.sd_client import SdClient

def init_session():
    # Please see above on how to obtain a ticket and a JWT
    jwt = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikp1c3QgYSB0ZXN0IiwiaWF0IjoxNjE4OTExMjcxLCJleHAiOjE2MTg5MTQ4OTcsImp0aSI6IjYzMjA3ODE3LWJiNWQtNDY3Zi04NzRkLWM4N2EyYzAxYmZlZCJ9.S5Ps_Fx5p6aJxdBOJMBKgpf2SIlp--6kkIZU55tiqEg"
    ticket = "8b23fae66cf535719a9ec797e390208b2003e3cfc894b7624ada2f6894515f8836a4-66303337623538322d34386"

    # Initialize the SDK client instance by providing the base URL
    client = SdClient(
        Configuration("https://sdeuc1.eu-central-1.shapediver.com", access_token=jwt)
    )

    # Initialize a new session using the ticket.
    res = SessionApi(client).create_session_by_ticket(ticket)
    print(res)

Examples

Examples on how to interact with available endpoints are given in the tests folder.

Versioning

We take care to provide backwards compatibility for all older versions. However, new features might be limited to newer API versions. Therefore, we recommend always using the newest API version out there.

Support

If you have questions, please use the ShapeDiver Help Center.

You can find out more about ShapeDiver right here.

Licensing

This project is released under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geometry_api_v2-1.3.0.tar.gz (262.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geometry_api_v2-1.3.0-py3-none-any.whl (440.1 kB view details)

Uploaded Python 3

File details

Details for the file geometry_api_v2-1.3.0.tar.gz.

File metadata

  • Download URL: geometry_api_v2-1.3.0.tar.gz
  • Upload date:
  • Size: 262.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.2

File hashes

Hashes for geometry_api_v2-1.3.0.tar.gz
Algorithm Hash digest
SHA256 280456c2e95a23d2b2a737b743a5edaaceddd7465eb31c9aa7c0b7414fe87c6b
MD5 95caa44137219d39ea197fce221d7ac4
BLAKE2b-256 6ba45eb624e2a7c31ca0c78b5149fe34c35411e401eac6e6257807fefddfcfa1

See more details on using hashes here.

File details

Details for the file geometry_api_v2-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for geometry_api_v2-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a53370c1e2aa04418f399d03a05540bc3dc7c24147c77c4bcc39a1107b89aef
MD5 de42cf1132bde8127b7accf0b472cc0d
BLAKE2b-256 32993aa3ece1cea3cd708d79d6be86cd04516d102e11ecb3e5a50208372d66a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page