forked from tableau/document-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththumbnail.py
More file actions
35 lines (27 loc) · 899 Bytes
/
thumbnail.py
File metadata and controls
35 lines (27 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import xml.etree.ElementTree as ET
class Thumbnail(object):
"""A class representing Tableau workbook thumbnail, embedded in workbook files or
in TDS files.
"""
def __init__(self, dsxml, filename=None):
"""
Constructor. Default is to create thumbnail from xml.
"""
self._datasourceXML = dsxml
self._datasourceTree = ET.ElementTree(self._datasourceXML)
self._height = self._datasourceXML.get('height')
self._width = self._datasourceXML.get('width')
self._name = self._datasourceXML.get('name')
self._image_data = self._datasourceXML.text
@property
def height(self):
return self._height
@property
def width(self):
return self._width
@property
def name(self):
return self._name
@property
def image_data(self):
return self._image_data