Skip to content

Commit

Permalink
Fix cli, add an example
Browse files Browse the repository at this point in the history
  • Loading branch information
benogle committed Feb 16, 2024
1 parent d6648c1 commit 4024b04
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/cli_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ Options:
-i, --input TEXT Filename of input CSV that provides data [required]
--help Show this message and exit.
```

For example, you can fill a sample PDF template with the following command

```shell
$ ANVIL_API_KEY=MY_GENERATED_KEY anvil fill-pdf -o test.pdf -i examples/cli/fill_pdf.csv 05xXsZko33JIO6aq5Pnr
```
Empty file added examples/cli/__init__.py
Empty file.
2 changes: 2 additions & 0 deletions examples/cli/fill_pdf.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shortText,name,date
Test short,Bobby Jones,2028-01-03
2 changes: 1 addition & 1 deletion python_anvil/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def fill_pdf(ctx, template_id, out_filename, payload_csv):
with click.progressbar(payloads, label="Filling PDFs and saving") as ps:
indexed_files = utils.build_batch_filenames(out_filename)
for payload in ps:
res = anvil.fill_pdf(template_id, payload.to_dict(), debug=debug)
res = anvil.fill_pdf(template_id, payload.model_dump(), debug=debug)

if contains_headers(res):
res, headers = process_response(res)
Expand Down

0 comments on commit 4024b04

Please sign in to comment.