Skip to content
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
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Replace `my-api-key` below with your API key.
```py
import pdftables_api

c = pdftables_api.Client('my-api-key')
c.xlsx('input.pdf', 'output.xlsx')
c = pdftables_api.Client("my-api-key")
c.xlsx("input.pdf", "output.xlsx")
```

## Formats
Expand All @@ -53,15 +53,22 @@ You can specify which extraction engine to use when creating a `Client`. The ava
For AI extractors (`ai-1` and `ai-2`), you can also specify an `extract` option to control what content is extracted: `tables` (default) or `tables-paragraphs`.

```py
from pdftables_api import (Client, EXTRACTOR_AI_1, EXTRACTOR_AI_2,
EXTRACT_TABLES, EXTRACT_TABLES_PARAGRAPHS)
from pdftables_api import (
Client,
EXTRACTOR_AI_1,
EXTRACTOR_AI_2,
EXTRACT_TABLES,
EXTRACT_TABLES_PARAGRAPHS,
)

# Standard extractor (default)
c_standard = Client('my-api-key')
c_standard = Client("my-api-key")

# AI extractors for complex documents
c_ai_1 = Client('my-api-key', extractor=EXTRACTOR_AI_1, extract=EXTRACT_TABLES)
c_ai_2 = Client('my-api-key', extractor=EXTRACTOR_AI_2, extract=EXTRACT_TABLES_PARAGRAPHS)
c_ai_1 = Client("my-api-key", extractor=EXTRACTOR_AI_1, extract=EXTRACT_TABLES)
c_ai_2 = Client(
"my-api-key", extractor=EXTRACTOR_AI_2, extract=EXTRACT_TABLES_PARAGRAPHS
)
```

See [PDFTables API documentation](https://pdftables.com/pdf-to-excel-api#extractors) for details.
Expand Down Expand Up @@ -91,6 +98,6 @@ The below example allows 60 seconds to connect to our server, and 1 hour to conv
```py
import pdftables_api

c = pdftables_api.Client('my-api-key', timeout=(60, 3600))
c.xlsx('input.pdf', 'output.xlsx')
c = pdftables_api.Client("my-api-key", timeout=(60, 3600))
c.xlsx("input.pdf", "output.xlsx")
```
10 changes: 5 additions & 5 deletions pdftables_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
)

__all__ = [
"EXTRACTOR_AI_1",
"EXTRACTOR_AI_2",
"EXTRACTOR_STANDARD",
"EXTRACT_TABLES",
"EXTRACT_TABLES_PARAGRAPHS",
"FORMAT_CSV",
"FORMAT_XLSX",
"FORMAT_XLSX_MULTIPLE",
"FORMAT_XLSX_SINGLE",
"FORMAT_XML",
"APIException",
"Client",
"EXTRACTOR_STANDARD",
"EXTRACTOR_AI_1",
"EXTRACTOR_AI_2",
"EXTRACT_TABLES",
"EXTRACT_TABLES_PARAGRAPHS",
]
2 changes: 1 addition & 1 deletion pdftables_api/pdftables_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def ensure_format_ext(out_path, out_format):
Ensure the appropriate file extension and format is given. If not
provided, try to guess either.
"""
if out_format is not None and out_format not in _FORMATS_EXT.keys():
if out_format is not None and out_format not in _FORMATS_EXT:
raise ValueError("Invalid output format")

default_format = FORMAT_XLSX_MULTIPLE
Expand Down
38 changes: 19 additions & 19 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading