Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
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
9 changes: 7 additions & 2 deletions 9 samples/download_view_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def main():
parser.add_argument('--view-name', '-v', required=True,
help='name of view to download an image of')
parser.add_argument('--filepath', '-f', required=True, help='filepath to save the image returned')
parser.add_argument('--maxage', '-m', required=False, help='max age of the image in the cache in minutes.')
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
help='desired logging level (set to error by default)')

Expand Down Expand Up @@ -55,8 +56,12 @@ def main():
raise LookupError("View with the specified name was not found.")
view_item = all_views[0]

# Step 3: Query the image endpoint and save the image to the specified location
image_req_option = TSC.ImageRequestOptions(imageresolution=TSC.ImageRequestOptions.Resolution.High)
max_age = args.maxage
if not max_age:
max_age = 1

image_req_option = TSC.ImageRequestOptions(imageresolution=TSC.ImageRequestOptions.Resolution.High,
maxage=max_age)
server.views.populate_image(view_item, image_req_option)

with open(args.filepath, "wb") as image_file:
Expand Down
5 changes: 4 additions & 1 deletion 5 tableauserverclient/server/request_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,17 @@ class ImageRequestOptions(_FilterOptionsBase):
class Resolution:
High = 'high'

def __init__(self, imageresolution=None):
def __init__(self, imageresolution=None, maxage=None):
super(ImageRequestOptions, self).__init__()
self.image_resolution = imageresolution
self.max_age = maxage

def apply_query_params(self, url):
params = []
if self.image_resolution:
params.append('resolution={0}'.format(self.image_resolution))
if self.max_age:
params.append('maxAge={0}'.format(self.max_age))

self._append_view_filters(params)

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.