WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center
WORKFLOW

Call a Wolfram API from Python

Using a Wolfram notebook...

Create the API

Create a simple APIFunction:

Deploy the API

Deploy the API to the Wolfram Cloud:

Prepare the input parameters

API inputs are passed as named parameters using a Python dictionary:

inputs = { 'a' : 3, 'b' : 2 }

Make the call

Using an authenticated cloud session, call the API from Python:

response = session.call( 'https://www.wolframcloud.com/objects/documentation/api/plus', inputs )
  • This workflow requires the Wolfram Client Library for Python, installed as described in Install the Wolfram Client Library for Python.
  • session is the authenticated cloud session instantiated during this workflow: Connect Python to the Wolfram Cloud.

Get the Response

response.get()

Verify that the type passed to the Wolfram Language is consistent:

Using a Jupyter notebook...

Create the API

Create a simple APIFunction:

Deploy the API

Deploy the API to the Wolfram Cloud:

Prepare the input parameters

API inputs are passed as named parameters using a Python dictionary:

Make the call

Using an authenticated cloud session, call the API from Python:

  • This workflow requires the Wolfram Client Library for Python, installed as described in Install the Wolfram Client Library for Python.
  • session is the authenticated cloud session instantiated during this workflow: Connect Python to the Wolfram Cloud.

Get the response

Verify that the type passed to Python is consistent:

Related Functions

APIFunction   CloudDeploy   CloudObject   Head

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /