pdf-table-pull-lite 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pdf_table_pull_lite-1.1.0.dist-info/METADATA +165 -0
- pdf_table_pull_lite-1.1.0.dist-info/RECORD +8 -0
- pdf_table_pull_lite-1.1.0.dist-info/WHEEL +5 -0
- pdf_table_pull_lite-1.1.0.dist-info/entry_points.txt +3 -0
- pdf_table_pull_lite-1.1.0.dist-info/licenses/LICENSE +9 -0
- pdf_table_pull_lite-1.1.0.dist-info/top_level.txt +2 -0
- pdf_table_pull_lite.py +131 -0
- pdf_table_pull_lite_mcp.py +43 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pdf-table-pull-lite
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Pull the tables out of a text PDF into CSV files. Runs locally. CLI and MCP server.
|
|
5
|
+
Author: Tidy Byte Tools
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://tidybyte.gumroad.com/l/hkxqxh
|
|
8
|
+
Project-URL: Source, https://github.com/tidybytetools/pdf-table-pull-lite
|
|
9
|
+
Project-URL: Issues, https://github.com/tidybytetools/pdf-table-pull-lite/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/tidybytetools/pdf-table-pull-lite/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: pdf,table,csv,extract,pdf-to-csv,pdfplumber,cli,mcp,mcp-server
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Office/Business
|
|
24
|
+
Classifier: Topic :: Text Processing
|
|
25
|
+
Classifier: Topic :: Utilities
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: pdfplumber>=0.10
|
|
30
|
+
Requires-Dist: mcp<2,>=1.2
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# pdf-table-pull-lite
|
|
34
|
+
|
|
35
|
+
[](https://github.com/tidybytetools/pdf-table-pull-lite/blob/main/LICENSE)
|
|
36
|
+
[](https://www.python.org/)
|
|
37
|
+
[](#use-it-from-claude-desktop-or-cursor-mcp)
|
|
38
|
+
|
|
39
|
+
Free tool that pulls the tables out of a text PDF and saves each one as a CSV file.
|
|
40
|
+
Need Excel output, scanned PDFs or tables joined across pages? The paid version does that: **[pdf-table-pull on Gumroad](https://tidybyte.gumroad.com/l/hkxqxh)**
|
|
41
|
+
|
|
42
|
+
Runs on your own computer, so your PDFs are never uploaded anywhere. MIT license. Python 3.10 or newer, on Windows, Mac and Linux.
|
|
43
|
+
|
|
44
|
+
<!-- mcp-name: io.github.tidybytetools/pdf-table-pull-lite -->
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
pip install pdf-table-pull-lite
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or use pipx, which keeps it in its own space:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
pipx install pdf-table-pull-lite
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Want the newest code from GitHub instead?
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
pip install git+https://github.com/tidybytetools/pdf-table-pull-lite
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Use it
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
pdf-table-pull-lite statement.pdf # CSVs go in statement_tables/
|
|
68
|
+
pdf-table-pull-lite statement.pdf -o out/ -p 2-5 # only pages 2 to 5
|
|
69
|
+
pdf-table-pull-lite statement.pdf -s text # tables with no border lines
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Example run:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
Found 2 table(s).
|
|
76
|
+
page1_table1: 2 rows x 3 columns
|
|
77
|
+
page1_table2: 2 rows x 2 columns
|
|
78
|
+
Saved: statement_tables/page1_table1.csv
|
|
79
|
+
Saved: statement_tables/page1_table2.csv
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
You get one CSV per table, named after its page. The CSVs open straight in Excel (they're saved as UTF-8 with a BOM so accents show correctly).
|
|
83
|
+
|
|
84
|
+
`--strategy` (`-s`): `lines` is for tables with ruled borders, `text` is for tables lined up by spacing, and `auto` (the default) tries lines first, then text.
|
|
85
|
+
|
|
86
|
+
When you run it in a terminal it ends with one short line about the paid version. `--quiet` turns it off, and it never shows when output is piped or redirected.
|
|
87
|
+
|
|
88
|
+
## Known limits
|
|
89
|
+
|
|
90
|
+
- **Scanned PDFs.** Pages that are just an image (no text layer) are skipped, and the tool tells you which ones.
|
|
91
|
+
- **Tables that continue onto the next page** come out as separate CSVs, one per page.
|
|
92
|
+
- **Odd layouts.** Tables with merged cells or no clear columns can come out with cells in the wrong spot. Check the CSV.
|
|
93
|
+
- **CSV only.** No Excel or JSON output, no number cleanup (so `(40)` stays as text), and no password-protected PDFs.
|
|
94
|
+
|
|
95
|
+
## Lite vs paid
|
|
96
|
+
|
|
97
|
+
| | lite (free) | [pdf-table-pull](https://tidybyte.gumroad.com/l/hkxqxh) |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| Text PDFs, ruled or spaced tables | yes | yes |
|
|
100
|
+
| CSV output | yes | yes |
|
|
101
|
+
| Excel (one sheet per table) and JSON output | no | yes |
|
|
102
|
+
| Scanned PDFs (OCR) | no | yes |
|
|
103
|
+
| Join tables across pages | no | yes |
|
|
104
|
+
| Numbers cleaned (`1,200` → 1200, `(40)` → -40) | no | yes |
|
|
105
|
+
| Password-protected PDFs | no | yes |
|
|
106
|
+
|
|
107
|
+
## How it compares to other free tools
|
|
108
|
+
|
|
109
|
+
All of these are free and open source. Pick what fits you.
|
|
110
|
+
|
|
111
|
+
| | pdf-table-pull-lite | [pdfplumber](https://github.com/jsvine/pdfplumber) | [Camelot](https://github.com/camelot-dev/camelot) | [tabula-py](https://github.com/chezou/tabula-py) |
|
|
112
|
+
|---|---|---|---|---|
|
|
113
|
+
| What it is | Command line tool | Python library | Python library + CLI | Python wrapper for Tabula |
|
|
114
|
+
| Needs Java | no | no | no | yes |
|
|
115
|
+
| One command to get CSVs | yes | no, you write code | yes | yes |
|
|
116
|
+
| Picks border or spacing mode for you | yes (`auto`) | no | no | yes (guess) |
|
|
117
|
+
| Tells you which pages are scans | yes | no | no | no |
|
|
118
|
+
| Built-in MCP server for AI apps | yes | no | no | no |
|
|
119
|
+
| Lots of tuning knobs | no | yes | yes | some |
|
|
120
|
+
|
|
121
|
+
This tool is built on pdfplumber. If you want full control in your own code, use pdfplumber or Camelot directly.
|
|
122
|
+
|
|
123
|
+
## Use it from Claude Desktop or Cursor (MCP)
|
|
124
|
+
|
|
125
|
+
There is a small free MCP server built in. It gives your AI app one tool, `extract_pdf_tables`. It needs [uv](https://docs.astral.sh/uv/).
|
|
126
|
+
|
|
127
|
+
Run it by hand to check it starts (it waits quietly for an app to talk to it):
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
uvx --from pdf-table-pull-lite pdf-table-pull-lite-mcp
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Claude Desktop (`claude_desktop_config.json`) or Cursor (`~/.cursor/mcp.json`):
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"mcpServers": {
|
|
138
|
+
"pdf-table-pull-lite": {
|
|
139
|
+
"command": "uvx",
|
|
140
|
+
"args": ["--from", "pdf-table-pull-lite", "pdf-table-pull-lite-mcp"]
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Tool: `extract_pdf_tables(path, pages="", strategy="auto", output_dir="")`. It returns a list with the CSV text of each table. If you set `output_dir`, it saves the CSVs there and returns the file paths instead.
|
|
147
|
+
|
|
148
|
+
## For AI agents
|
|
149
|
+
|
|
150
|
+
- **Use when:** you have a local PDF with real text (you can select the words) and need its tables as rows.
|
|
151
|
+
- **Don't use when:** the PDF is a scan or photo, it has a password, or you need Excel. Those pages get skipped. Use the paid version for those.
|
|
152
|
+
- **Input:** a file path, plus optional `pages` like `1,3-5` and `strategy` (`auto`, `lines`, `text`).
|
|
153
|
+
- **Output:** a list of CSV strings, one per table, first row is the header. Empty list means no tables were found.
|
|
154
|
+
- CLI exit code is 0 on success and 1 on error (message on stderr). See also [`llms.txt`](https://github.com/tidybytetools/pdf-table-pull-lite/blob/main/llms.txt).
|
|
155
|
+
|
|
156
|
+
## Tests
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
pip install pdfplumber "mcp<2"
|
|
160
|
+
python3 -m unittest discover tests
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
MIT. See `LICENSE`.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
pdf_table_pull_lite.py,sha256=YrWSR1ekzV9_3i-Sb_pxkH26Gyex-bOW-u-B78fRAZU,5295
|
|
2
|
+
pdf_table_pull_lite_mcp.py,sha256=jerlemM-CqxvB9rZ3x9VVUBRf6BLD0OgfsJUMWheFX4,1414
|
|
3
|
+
pdf_table_pull_lite-1.1.0.dist-info/licenses/LICENSE,sha256=IpHMoXz-sReyVcPkfbf_wfCz9SMBH18CuE2B6ALlrbI,1065
|
|
4
|
+
pdf_table_pull_lite-1.1.0.dist-info/METADATA,sha256=aM5eMjp3Om6W7gLaNA-B5ZkHKyB9VJi2G18I2_2ibHE,6704
|
|
5
|
+
pdf_table_pull_lite-1.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
6
|
+
pdf_table_pull_lite-1.1.0.dist-info/entry_points.txt,sha256=BJw9YQtKCJUvdzWzmDtTIquNYFNfc8LtIPrpocJIJAg,120
|
|
7
|
+
pdf_table_pull_lite-1.1.0.dist-info/top_level.txt,sha256=vg9t6OsodserQXahvuuxyIcmae7HS2wJoHH1Qd3tlgk,44
|
|
8
|
+
pdf_table_pull_lite-1.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tidybyte
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
pdf_table_pull_lite.py
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""pdf-table-pull-lite: pull the tables out of a text PDF into CSV files.
|
|
3
|
+
|
|
4
|
+
Free, MIT-licensed lite edition. The paid version (pdf-table-pull) adds Excel and
|
|
5
|
+
JSON output, scanned-PDF OCR, joining tables across pages, and number cleanup:
|
|
6
|
+
https://tidybyte.gumroad.com/l/hkxqxh
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
pdf-table-pull-lite report.pdf
|
|
10
|
+
pdf-table-pull-lite report.pdf -o out_dir/ --pages 2-5
|
|
11
|
+
"""
|
|
12
|
+
import argparse, csv, os, re, sys
|
|
13
|
+
|
|
14
|
+
__version__ = "1.1.0"
|
|
15
|
+
PRO_URL = "https://tidybyte.gumroad.com/l/hkxqxh"
|
|
16
|
+
PRO_LINE = f"Need Excel output, scanned PDFs or tables joined across pages? pdf-table-pull (paid): {PRO_URL}"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def parse_pages(spec, total):
|
|
20
|
+
"""'1,3-5' -> [1,3,4,5] (1-based). None means every page."""
|
|
21
|
+
if not spec:
|
|
22
|
+
return list(range(1, total + 1))
|
|
23
|
+
pages = []
|
|
24
|
+
for part in spec.split(","):
|
|
25
|
+
part = part.strip()
|
|
26
|
+
if not part:
|
|
27
|
+
continue
|
|
28
|
+
if "-" in part:
|
|
29
|
+
a, b = part.split("-", 1)
|
|
30
|
+
pages.extend(range(int(a) if a else 1, (int(b) if b else total) + 1))
|
|
31
|
+
else:
|
|
32
|
+
pages.append(int(part))
|
|
33
|
+
bad = [p for p in pages if p < 1 or p > total]
|
|
34
|
+
if bad:
|
|
35
|
+
raise ValueError(f"page {bad[0]} is out of range (PDF has {total} pages)")
|
|
36
|
+
return sorted(set(pages))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _clean_cell(c):
|
|
40
|
+
return "" if c is None else re.sub(r"\s+", " ", str(c)).strip()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _clean_table(rows):
|
|
44
|
+
rows = [[_clean_cell(c) for c in r] for r in rows]
|
|
45
|
+
rows = [r for r in rows if any(r)]
|
|
46
|
+
if not rows:
|
|
47
|
+
return []
|
|
48
|
+
width = max(len(r) for r in rows)
|
|
49
|
+
rows = [r + [""] * (width - len(r)) for r in rows]
|
|
50
|
+
keep = [i for i in range(width) if any(r[i] for r in rows)]
|
|
51
|
+
return [[r[i] for i in keep] for r in rows]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def extract(pdf_path, pages=None, strategy="auto"):
|
|
55
|
+
"""Return (tables, scanned_pages). tables: list of {'page', 'index', 'rows'}.
|
|
56
|
+
Pages with no text layer (scans) are skipped and listed in scanned_pages."""
|
|
57
|
+
import pdfplumber
|
|
58
|
+
if strategy not in ("auto", "lines", "text"):
|
|
59
|
+
raise ValueError("strategy must be lines, text or auto")
|
|
60
|
+
lines = {"vertical_strategy": "lines", "horizontal_strategy": "lines"}
|
|
61
|
+
text = {"vertical_strategy": "text", "horizontal_strategy": "text"}
|
|
62
|
+
out, scanned = [], []
|
|
63
|
+
with pdfplumber.open(pdf_path) as pdf:
|
|
64
|
+
for pno in parse_pages(pages, len(pdf.pages)):
|
|
65
|
+
page = pdf.pages[pno - 1]
|
|
66
|
+
if not page.chars:
|
|
67
|
+
scanned.append(pno)
|
|
68
|
+
continue
|
|
69
|
+
if strategy == "auto":
|
|
70
|
+
found = page.extract_tables(lines)
|
|
71
|
+
if not any(_clean_table(t) for t in found):
|
|
72
|
+
found = page.extract_tables(text)
|
|
73
|
+
else:
|
|
74
|
+
found = page.extract_tables(lines if strategy == "lines" else text)
|
|
75
|
+
k = 0
|
|
76
|
+
for t in found:
|
|
77
|
+
rows = _clean_table(t)
|
|
78
|
+
if not rows or (len(rows) < 2 and strategy != "lines"):
|
|
79
|
+
continue
|
|
80
|
+
k += 1
|
|
81
|
+
out.append({"page": pno, "index": k, "rows": rows})
|
|
82
|
+
return out, scanned
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def write_csv(tables, out_dir):
|
|
86
|
+
os.makedirs(out_dir, exist_ok=True)
|
|
87
|
+
paths = []
|
|
88
|
+
for t in tables:
|
|
89
|
+
p = os.path.join(out_dir, f"page{t['page']}_table{t['index']}.csv")
|
|
90
|
+
with open(p, "w", newline="", encoding="utf-8-sig") as f:
|
|
91
|
+
csv.writer(f).writerows(t["rows"])
|
|
92
|
+
paths.append(p)
|
|
93
|
+
return paths
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def main(argv=None):
|
|
97
|
+
ap = argparse.ArgumentParser(prog="pdf-table-pull-lite",
|
|
98
|
+
description="Pull tables out of a text PDF into CSV files (one file per table).",
|
|
99
|
+
epilog=PRO_LINE)
|
|
100
|
+
ap.add_argument("pdf")
|
|
101
|
+
ap.add_argument("-o", "--output", help="output folder (default: <pdf name>_tables next to the PDF)")
|
|
102
|
+
ap.add_argument("-p", "--pages", help="pages to read, e.g. 1,3-5 (default: all)")
|
|
103
|
+
ap.add_argument("-s", "--strategy", choices=["auto", "lines", "text"], default="auto",
|
|
104
|
+
help="lines = tables with ruled borders, text = tables lined up by spacing, auto = try lines then text")
|
|
105
|
+
ap.add_argument("-q", "--quiet", action="store_true", help="don't print the one-line note about the paid version")
|
|
106
|
+
ap.add_argument("--version", action="version", version=__version__)
|
|
107
|
+
a = ap.parse_args(argv)
|
|
108
|
+
try:
|
|
109
|
+
if not os.path.isfile(a.pdf):
|
|
110
|
+
raise FileNotFoundError(f"file not found: {a.pdf}")
|
|
111
|
+
tables, scanned = extract(a.pdf, a.pages, a.strategy)
|
|
112
|
+
files = write_csv(tables, a.output or os.path.splitext(a.pdf)[0] + "_tables")
|
|
113
|
+
print(f"Found {len(tables)} table(s).")
|
|
114
|
+
for t in tables:
|
|
115
|
+
print(f" page{t['page']}_table{t['index']}: {len(t['rows']) - 1} rows x {len(t['rows'][0])} columns")
|
|
116
|
+
for p in files:
|
|
117
|
+
print(f"Saved: {p}")
|
|
118
|
+
if scanned:
|
|
119
|
+
print(f"Skipped page(s) {', '.join(map(str, scanned))}: no text layer (scanned image). The lite version reads text PDFs only.")
|
|
120
|
+
elif not tables:
|
|
121
|
+
print("Tip: no tables found. Try --strategy text.")
|
|
122
|
+
if not a.quiet and sys.stdout.isatty():
|
|
123
|
+
print(PRO_LINE)
|
|
124
|
+
return 0
|
|
125
|
+
except Exception as e:
|
|
126
|
+
print(f"Error: {e}", file=sys.stderr)
|
|
127
|
+
return 1
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
if __name__ == "__main__":
|
|
131
|
+
sys.exit(main())
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Free MCP server for pdf-table-pull-lite (stdio).
|
|
2
|
+
|
|
3
|
+
Run: uvx --from git+https://github.com/tidybytetools/pdf-table-pull-lite pdf-table-pull-lite-mcp
|
|
4
|
+
"""
|
|
5
|
+
import csv, io, os
|
|
6
|
+
from mcp.server.fastmcp import FastMCP
|
|
7
|
+
import pdf_table_pull_lite as lite
|
|
8
|
+
|
|
9
|
+
mcp = FastMCP("pdf-table-pull-lite")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@mcp.tool()
|
|
13
|
+
def extract_pdf_tables(path: str, pages: str = "", strategy: str = "auto", output_dir: str = "") -> list[str]:
|
|
14
|
+
"""Pull the tables out of a local text PDF.
|
|
15
|
+
|
|
16
|
+
path: full path to a PDF on this computer.
|
|
17
|
+
pages: optional, like "1,3-5". Empty means all pages.
|
|
18
|
+
strategy: "auto" (default), "lines" (ruled borders) or "text" (lined up by spacing).
|
|
19
|
+
output_dir: optional. If set, each table is saved there as a CSV and the file paths
|
|
20
|
+
are returned. If empty, the CSV text of each table is returned.
|
|
21
|
+
|
|
22
|
+
Scanned (image-only) pages have no text and are skipped. Returns [] if no tables.
|
|
23
|
+
"""
|
|
24
|
+
path = os.path.expanduser(path)
|
|
25
|
+
if not os.path.isfile(path):
|
|
26
|
+
raise FileNotFoundError(f"file not found: {path}")
|
|
27
|
+
tables, _scanned = lite.extract(path, pages or None, strategy)
|
|
28
|
+
if output_dir:
|
|
29
|
+
return lite.write_csv(tables, os.path.expanduser(output_dir))
|
|
30
|
+
out = []
|
|
31
|
+
for t in tables:
|
|
32
|
+
buf = io.StringIO()
|
|
33
|
+
csv.writer(buf).writerows(t["rows"])
|
|
34
|
+
out.append(buf.getvalue())
|
|
35
|
+
return out
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def main():
|
|
39
|
+
mcp.run()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if __name__ == "__main__":
|
|
43
|
+
main()
|