Swarmauri Tool Download PDF
Tool that downloads a PDF by URL and returns the file contents as a base64-encoded string, enabling downstream storage or inline embedding without touching disk.
Features
- Uses
requeststo stream PDF bytes. - Encodes the result into base64 (
contentfield) and includes a success message. - Returns an
errorkey when download or processing fails.
Prerequisites
- Python 3.10 or newer.
requests(installed automatically).- Network access to the target PDF URL.
Installation
# pip
pip install swarmauri_tool_downloadpdf
# poetry
poetry add swarmauri_tool_downloadpdf
# uv (pyproject-based projects)
uv add swarmauri_tool_downloadpdf
Quickstart
import base64
from pathlib import Path
from swarmauri_tool_downloadpdf import DownloadPDFTool
tool = DownloadPDFTool()
result = tool("https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf")
if "error" in result:
print(result["error"])
else:
pdf_bytes = base64.b64decode(result["content"])
Path("downloaded.pdf").write_bytes(pdf_bytes)
Tips
- Always check for the
errorkey before assuming the download succeeded. - Large PDFs load into memory—consider chunking or alternative tools if you need to stream huge files directly to disk.
- Validate URLs to avoid downloading untrusted content when wiring this tool into automated pipelines.
Want to help?
If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.
Metadata
Release files for swarmauri_tool_downloadpdf 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swarmauri_tool_downloadpdf-0.10.0.tar.gz | 7.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmauri_tool_downloadpdf-0.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.7 kB
Release files / swarmauri_tool_downloadpdf-0.10.0.tar.gz
| Download URL | swarmauri_tool_downloadpdf-0.10.0.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73d73564f2f2b056e1aa026cf1759b98c64d571a756bbd87ccea108492b1a688
|
|
BLAKE2b-256 checksum How to use checksums |
005d17868ba2337b2800946b57a5a9ab8d65bf5f0180ef9526a278e745b22ace
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_tool_downloadpdf-0.10.0-py3-none-any.whl
| Download URL | swarmauri_tool_downloadpdf-0.10.0-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1324ad2625ced7157e014723bda029dfa22df96059c41bf509375b11b7e3ea9
|
|
BLAKE2b-256 checksum How to use checksums |
d2ffb5b036eb0504aa4f0eeff24ca5c8dda4d3b2fe452cfcf4a70bdd6532c898
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|