Skip to main content

Swarmauri Community Download PDF Tool

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_downloadpdf


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 requests to stream PDF bytes.
  • Encodes the result into base64 (content field) and includes a success message.
  • Returns an error key 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 error key 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

swarmauri_tool_downloadpdf-0.9.2.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swarmauri_tool_downloadpdf-0.9.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_tool_downloadpdf-0.9.2.tar.gz.

File metadata

  • Download URL: swarmauri_tool_downloadpdf-0.9.2.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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

Hashes for swarmauri_tool_downloadpdf-0.9.2.tar.gz
Algorithm Hash digest
SHA256 e751168938bf9a104a655f09219a16b6b4d834de1c9d6cbcfad2cf028660873b
MD5 bcba788d7af39b3715bce361d30e8053
BLAKE2b-256 9592d4d8dd40622fe5ad5dbd3bda6c632e5be06f14e82383544fdeaded3defbe

See more details on using hashes here.

File details

Details for the file swarmauri_tool_downloadpdf-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_downloadpdf-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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

Hashes for swarmauri_tool_downloadpdf-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d9c25455d25460fc8a702b84a14b7e9e481295670d229356fffe1ceb7ba66055
MD5 28d0a4d8034d3483d37f15cd40b60eeb
BLAKE2b-256 5c5a68fc9dd6c39a02cce8d2614f9c50f3b2b34b5844dbb6ddd71bb5e405e2e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page