Swarmauri Community Download PDF Tool
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_tool_downloadpdf-0.9.0.dev21.tar.gz.
File metadata
- Download URL: swarmauri_tool_downloadpdf-0.9.0.dev21.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3de22078154e4478c84492fa8411d3ea454deef51f46c5aea7300de4f39bbc1
|
|
| MD5 |
b4f790f2670f23241bcb960ce7afbd46
|
|
| BLAKE2b-256 |
bd18209d3286c64673b7fb4053d0dc24699428cedb1d039f7faf6f67774ef642
|
File details
Details for the file swarmauri_tool_downloadpdf-0.9.0.dev21-py3-none-any.whl.
File metadata
- Download URL: swarmauri_tool_downloadpdf-0.9.0.dev21-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba80b3237637dac781d8624ccf9656217b2d7e40470a5340805444c942c03954
|
|
| MD5 |
5728a1a44efa8d6a8d924f7a58c01089
|
|
| BLAKE2b-256 |
13f0f51d1ff7807a7a8bd2939a8ad90c4b31abd59df8a468055b6fdd175ae949
|