- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise
- >
- Re: Morpheus API Calls from Python
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2022 01:59 PM
03-30-2022 01:59 PM
Morpheus API Calls from Python
I use Python to interact with Morpheus for internal and external clients and I wanted an easy way to make calls to the Morpheus API without dealing with Python requests. Enter pymorpheus, an easy Python module to act as a wrapper to the Morpheus API.
If I wanted to get a list of instances with a phrase matching “test”, it’s super easy:
from pymorpheus import MorpheusClient
morpheus = MorpheusClient("https://yoururl", username="youruser", password="yourpass")
results = morpheus.call("get", path="instances", options=[("phrase","testing")])
print(results)
Adding json payloads to POST calls is handled within the same call as well. You can also use a token to authenticate.
- Tags:
- Python
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2022 02:35 PM
03-30-2022 02:35 PM
Re: Morpheus API Calls from Python
@jwheeler 's solution will work for user level. If using it in a Python task in Morpheus, you can put pymorpheus into the Additional Packages box of the task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 06:24 AM
03-31-2022 06:24 AM
Re: Morpheus API Calls from Python
Absolutely. Those will be ephemeral for the duration of the task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2022 01:55 PM
04-20-2022 01:55 PM
Re: Morpheus API Calls from Python
Thanks for sharing! Is the source available anywhere?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2022 02:04 PM
03-30-2022 02:04 PM
Re: Morpheus API Calls from Python
pip install pymorpheus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 04:07 AM
03-31-2022 04:07 AM
Re: Morpheus API Calls from Python
Instead of username, password and url, can we use morpheus[‘morpheus’][‘apiAccessToken’] and morpheus[‘morpheus’][‘applianceUrl’] ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2022 02:01 PM
03-30-2022 02:01 PM
Re: Morpheus API Calls from Python
How do I install pymorpheus?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2022 03:33 PM
04-20-2022 03:33 PM
Re: Morpheus API Calls from Python
As a matter of fact, it is!
It’s just a wrapper to make requests easier to deal with. Not incredibly robust.