Skip to content

Commit

Permalink
Merge pull request #13 from manueliglesiasgarcia/master
Browse files Browse the repository at this point in the history
Add page and page_size to find query
  • Loading branch information
opus-42 authored Apr 20, 2022
2 parents e5f1e9e + 0327038 commit 26a583a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions supersetapiclient/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,26 +258,27 @@ def get(self, id: int):

return object

def find(self, **kwargs):
def find(self, page_size: int = 100, page: int = 0, **kwargs):
"""Find and get objects from api."""
url = self.base_url

# Get response
if kwargs != {}:
query = {
query = {
"page_size": page_size,
"page": page,
"filters": [
{
"col": k,
"opr": "eq",
"value": v
} for k, v in kwargs.items()
]
}
params = {
"q": json.dumps(query)
}
else:
params = {}
}

params = {
"q": json.dumps(query)
}

response = self.client.get(
url,
params=params
Expand Down

0 comments on commit 26a583a

Please sign in to comment.