Skip to content

Commit ee2230f

Browse files
akshowhiniExtractTable
authored andcommitted
"pages" param visibility (#14)
1 parent 3446d66 commit ee2230f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

ExtractTable/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = (1, 2, 0)
1+
VERSION = (1, 2, 1)
22
PRERELEASE = None # "alpha", "beta" or "rc"
33
REVISION = None
44

ExtractTable/client.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def _make_request(self, method, host: urlparse, params: dict = None, data: dict
4949
"""
5050
host = host if not host.startswith("http") else host.split("/")[2]
5151
url = urlparse.urlunparse(('https', host, '', '', '', ''))
52+
data.update({"library": kwargs.get("library", "ExtractTable")})
5253
self.ServerResponse = self._session.request(method, url, params=params, data=data, **kwargs)
5354
ResponseParser(resp=self.ServerResponse, show_warn=self._WARNINGS)
5455
return self.ServerResponse.json()
@@ -107,6 +108,7 @@ def trigger_process(self, fp: io.BufferedReader, dup_check: bool = False, **kwar
107108
def process_file(
108109
self,
109110
filepath: ty.Union[str, bytes, os.PathLike],
111+
pages: ty.Union[str] = "1",
110112
output_format: str = "df",
111113
dup_check: bool = False,
112114
indexing: bool = False,
@@ -115,16 +117,16 @@ def process_file(
115117
"""
116118
Trigge the file for processing and returns the tabular data in the user requested output format
117119
:param filepath: Location of the file
120+
:param pages : str, optional (default: '1')
121+
Comma-separated page numbers.
122+
Example: '1,3,4' or '1,4-end' or 'all'.
118123
:param output_format: datafram as default; Check `ExtractTable._OUTPUT_FORMATS` to see available options
119124
:param dup_check: Idempotent requests handler
120125
:param indexing: If row index is needed
121126
:param kwargs:
122127
max_wait_time: int, optional (default: 300);
123128
Maximum Time to wait before returning to the client
124-
pages : str, optional (default: '1')
125-
Comma-separated page numbers.
126-
Example: '1,3,4' or '1,4-end' or 'all'.
127-
anyother form-data to be sent to the server for future considerations
129+
any other form-data to be sent to the server for future considerations
128130
:return: user requested output in list;
129131
"""
130132
# Raise a warning if unknown format is requested
@@ -134,7 +136,7 @@ def process_file(
134136
f"Assigned default format: {default_format}"
135137
warnings.warn(warn_msg)
136138

137-
with PrepareInput(filepath, pages=kwargs.pop("pages", "1")) as infile:
139+
with PrepareInput(filepath, pages=pages) as infile:
138140
with open(infile.filepath, 'rb') as fp:
139141
server_resp = self.trigger_process(fp, dup_check=dup_check, **kwargs)
140142

0 commit comments

Comments
 (0)