-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathpage_response.py
More file actions
66 lines (53 loc) · 1.63 KB
/
page_response.py
File metadata and controls
66 lines (53 loc) · 1.63 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .media_response import MediaResponse
from .frame_response import FrameResponse
class PageResponse(object):
"""
Represents information about an uploaded document Page
"""
def __init__(self, data=None):
"""
:param data: the data to parse
:type data: dict or None
"""
if data is None:
data = dict()
self.__capture_method = (
data["capture_method"] if "capture_method" in data.keys() else None
)
self.__media = MediaResponse(data["media"]) if "media" in data.keys() else None
self.__frames = [FrameResponse(frame) for frame in data.get("frames", [])]
self.__extraction_image_ids = data.get("extraction_image_ids", [])
@property
def capture_method(self):
"""
The capture method that was used for the Page
:return: the capture method
:rtype: str or None
"""
return self.__capture_method
@property
def media(self):
"""
The media associated with the Page
:return: the media
:rtype: MediaResponse or None
"""
return self.__media
@property
def frames(self):
"""
Returns the list of associated frames
:return: the frames
:rtype: list[FrameResponse]
"""
return self.__frames
@property
def extraction_image_ids(self):
"""
Returns the list of extraction image IDs
:return: the extraction image IDs
:rtype: list[str]
"""
return self.__extraction_image_ids