Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read Rules from Morta #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Utilities/morta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Utilities.morta.api as ma
import Utilities.morta.functions as mf


def read_rules_from_morta_table_view(morta_api_key, view_id):
"""Reads a Table View from Morta and returns a DataFrame.

Args:
morta_api_key: api key of the user to query Morta
view_id: table view where the rules reside

Returns:
DataFrame: Pandas DataFrame containing the rules data
"""
try:
view_rows = ma.get_view_rows(view_id=view_id, api_key=morta_api_key)
rules_dataframe = mf.morta_rows_to_dataframe(view_rows)
return rules_dataframe
except Exception as e:
print(f"Failed to read rules from Morta table view: {e}")
return None
Loading