Api client for the Shapeways API http://developers.shapeways.com
The API uses OAuth v1 to authenticate clients, so the following steps must be used.
Example:
client = Client("key", "secret")
url = client.connect()
# redirect user to `url`
# capture response url from authentication callback
client.verify_url(response_url)
# make api requests
info = client.get_api_info()
Constructor for a new shapeways.client.Client
Parameters: |
|
---|
Make an API call POST /models/v1
Required Parameters:
Optional Parameters:
Parameters: | params (dict) – dict of necessary parameters to make the api call |
---|---|
Returns: | model upload information |
Return type: | dict |
Raises: | Exception when any of the required parameters are missing |
Make an API call POST /models/{model_id}/files/v1
Required Parameters:
Optional Parameters:
Parameters: |
|
---|---|
Returns: | file upload information |
Return type: | dict |
Raises: | Exception when any of the required parameters are missing |
Make an API call POST /models/{model_id}/photos/v1
Required Parameters:
Optional Parameters:
Parameters: |
|
---|---|
Returns: | photo upload information |
Return type: | dict |
Raises: | Exception when the required parameter is missing |
Make an API call POST /orders/cart/v1
Required Parameters:
Optional Parameters:
Parameters: | params (dict) – dict of necessary parameters to make the api call |
---|---|
Returns: | whether or not the call was successful |
Return type: | dict |
Raises: | Exception when the required parameter is missing |
Get an OAuth request token and authentication url
Returns: | the authentication url that the user must visit or None on error |
---|---|
Return type: | str or None |
Make an API call DELETE /models/{model_id}/v1
Parameters: | model_id – the id of the model to delete |
---|---|
Returns: | information whether or not it was successful |
Return type: | dict |
Make an API call GET /api/v1
Returns: | api info |
---|---|
Return type: | dict |
Make an API call GET /orders/cart/v1
Returns: | items currently in the cart |
---|---|
Return type: | dict |
Make an API call GET /categories/v1
Returns: | information about all categories |
---|---|
Return type: | dict |
Make an API call GET /categories/{category_id}/v1
Parameters: | category_id (int) – the category to fetch information for |
---|---|
Returns: | information about a specific category |
Return type: | dict |
Make an API call GET /materials/{material_id}/v1
Parameters: | material_id (int) – the id of the material to fetch |
---|---|
Returns: | specific materials info |
Return type: | dict |
Make an API call GET /materials/v1
Returns: | information about all materials |
---|---|
Return type: | dict |
Make an API call GET /models/{model_id}/v1
Parameters: | model_id – the id of the model to fetch |
---|---|
Returns: | data for a specific model |
Return type: | dict |
Make an API call GET /models/{model_id}/files/{file_version}/v1
Parameters: |
|
---|---|
Returns: | the file information |
Return type: | dict |
Make an API call GET /models/{model_id}/info/v1
Parameters: | model_id – the id of the model to fetch |
---|---|
Returns: | information for a specific model |
Return type: | dict |
Make an API call GET /models/v1
Returns: | information about all user’s models |
---|---|
Return type: | dict |
Make an API call POST /price/v1
Required Parameters:
Optional Parameters:
Parameters: | params (dict) – dict of necessary parameters to make the api call |
---|---|
Returns: | pricing information for the params given |
Return type: | dict |
Raises: | Exception when any of the required parameters are missing |
Make an API call GET /printers/{printer_id}/v1
Parameters: | printer_id (int) – the printer to fetch information for |
---|---|
Returns: | information about a specific printer |
Return type: | dict |
Make an API call GET /printers/v1
Returns: | information about all printers |
---|---|
Return type: | dict |
Make an API call PUT /models/{model_id}/info/v1
Optional Parameters:
Parameters: |
|
---|---|
Returns: | the model information |
Return type: | dict |
Generate the full url for an API path
client = Client("key", "secret")
url = client.url("/api/")
# "https://api.shapeways.com/api/v1"
Parameters: | path (str) – The API path to get the url for |
---|---|
Returns: | the full url to path |
Return type: | str |
Get an access token and setup OAuth credentials for further use
If you have the full url or query string from the authentication callback then you can use shapeways.client.Client.verify_url() which will parse the correct parameters from the query string and call shapeways.client.Client.verify()
Parameters: |
|
---|
Parse parameters and properly call shapeways.client.Client.verify()
If you already have the oauth_token and oauth_verifier parameters parsed, use shapeways.client.Client.verify() directly instead.
Parameters: | url (str) – The response url or query string from the authentication callback |
---|