Examples
Get weather details using multion API

Get weather details using Multion-API ✨

This example goes over how to use multion API to get today's weather details.

Install Required Packages

Ensure you have the necessary packages installed by running the following commands in your terminal:

pip install multion -U

Import Required Libraries

In your Python script, import the required libraries for the example:

import multion

Log in to Multion

See various ways of login here: Login

Set API Mode

Switch the API to local mode to run the Agent locally with the MultiOn Browser Extension for development and testing

(You can enable the remote mode to run on our hosted cloud for production use)

response = multion.set_remote(False)

Create a New Session

Create a new session to initiate the weather query:

response = multion.create_session({"url": "https://www.google.com"})
print(response['message'])
session_id = response['session_id']
session_id

Update Session

If needed, update the session with additional information:

response = multion.step_session(session_id, {"input": "what is the weather today","url": "https://www.google.com"})
response['message']

Capture Screenshot

Capture a screenshot of the weather details:

multion.get_screenshot(response, height=800)

Close Session

Finally, close the session when done:

multion.close_session(session_id)

Thank you for exploring this Multion-API example. 😀

  • Should you have any questions, feel free to reach out on our Discord channel or directly to our team. Happy building! 😊