8000 Pass **kwargs through to the paged function in Pager by t8y8 · Pull Request #451 · tableau/server-client-python · GitHub
[go: up one dir, main page]

Skip to content

Pass **kwargs through to the paged function in Pager #451

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

Merged
merged 1 commit into from
Jun 25, 2019
Merged
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
8 changes: 6 additions & 2 deletions tableauserverclient/server/pager.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from functools import partial

from . import RequestOptions
from . import Sort

Expand All @@ -11,13 +13,15 @@ class Pager(object):
Will loop over anything that returns (List[ModelItem], PaginationItem).
"""

def __init__(self, endpoint, request_opts=None):
def __init__(self, endpoint, request_opts=None, **kwargs):

if hasattr(endpoint, 'get'):
# The simpliest case is to take an Endpoint and call its get
self._endpoint = endpoint.get
endpoint = partial(endpoint.get, **kwargs)
self._endpoint = endpoint
elif callable(endpoint):
# but if they pass a callable then use that instead (used internally)
endpoint = partial(endpoint, **kwargs)
self._endpoint = endpoint
else:
# Didn't get something we can page over
Expand Down
0