Pandafile Pro · Python

Upload and send large files from Python

Send a file of any size from a Python script, a Django or FastAPI app or a Jupyter notebook in three lines. The official pandafile package creates the transfer, uploads every file with resumable uploads, completes it and hands you a download link you can share or email.

Uploading a 200 GB render or a nightly database export with plain requests means one long HTTP request that fails if the network hiccups. The Pandafile SDK uploads in chunks with the open tus protocol, retries what fails, continues at the byte the server already has and can pick up again after your script restarts. It needs Python 3.9 or newer and has a single dependency, httpx.

Install

From PyPI, MIT licence.

pip install pandafile

Sync and async

Pandafile and AsyncPandafile with the same methods.

from pandafile import Pandafile

Safe to try

Test keys make real uploads that email nobody and expire after 24 hours.

pf_test_…

Install and set your API key

The API is included with Pandafile Pro and Team (see pricing). Create a key in Dashboard → Domain & API and put it in the environment, so it never ends up in your code or your Git history.

pip install pandafile
export PANDAFILE_API_KEY=pf_live_YOUR_KEY   # or pf_test_… while you build

Send a large file

transfers.send() does the whole job. Pass paths to files or folders – folders keep their structure, like dropping a folder on the website. Add recipients and each one gets a personal link by email; leave them out and just share result.url.

from pandafile import Pandafile

pf = Pandafile()  # reads PANDAFILE_API_KEY

result = pf.transfers.send(
    ["final-cut.mov", "stills/"],
    recipients=["client@example.com"],
    title="Final cut",
    message="Here is the final version – let me know what you think.",
    on_progress=lambda p: print(f"{p.percent:.1f} %  {p.files_done}/{p.files_total} files"),
)
print(result.url)  # https://pandafile.co/d/k3x9q2m7ab
print(result.id, result.bytes)

Besides paths, send() takes (name, bytes) tuples, {"name": ..., "data": ...} dictionaries and open binary file objects, so you can send something you generated in memory without writing it to disk first. Add password="…" for a download password, and tune concurrency (files uploaded at once, default 3) and chunk_size (default 16 MiB) for your connection.

Resume after a crash or restart

Within one run, dropped connections are retried automatically. To survive a crash, a deploy or a laptop going to sleep, save the send state whenever it changes and pass it back next time: finished files are skipped and the unfinished one continues where it stopped.

import json, pathlib
from pandafile import Pandafile

pf = Pandafile()
state_file = pathlib.Path("send-state.json")
state = json.loads(state_file.read_text()) if state_file.exists() else None

result = pf.transfers.send(
    ["huge.mxf"],
    state=state,
    on_state=lambda s: state_file.write_text(json.dumps(s)),
)
state_file.unlink(missing_ok=True)
print(result.url, "resumed" if result.resumed else "new")

The saved state contains the transfer's upload secret, so keep the file private.

Async: asyncio, FastAPI and friends

AsyncPandafile mirrors the sync client. Lists are paged for you, so async for walks every transfer.

import asyncio
from pandafile import AsyncPandafile

async def main():
    async with AsyncPandafile() as pf:
        result = await pf.transfers.send(["film.mov"], recipients=["producer@example.com"])
        print(result.url)
        async for t in pf.transfers.list(view="active"):
            print(t["id"], t["title"], t["download_count"])

asyncio.run(main())

Send a file that is already online

If the file lives on another server – an export bucket, a render farm, a CRM attachment – let Pandafile fetch it instead of downloading it to your machine first. Small imports come back ready; bigger ones keep downloading in the background.

t = pf.transfers.from_url(
    files=[{"url": "https://example.com/exports/invoices-march.pdf"}],
    title="Invoices March",
    recipients=["accounts@example.com"],
)
print(t["status"], t["url"])                      # ready, or uploading
if t["status"] == "uploading":
    print(pf.transfers.import_status(t["id"])["status"])  # downloading → ready

Check downloads, remind and extend

detail = pf.transfers.retrieve(result.id)
for r in detail["recipients"]:
    print(r["email"], "downloaded" if r.get("downloaded") else "not yet")

pf.transfers.remind(result.id, "client@example.com")      # email the link again
pf.transfers.add_recipients(result.id, ["editor@example.com"])
pf.transfers.update(result.id, extend=True)                # 30 more days (Pro)

Errors and retries

Rate limits (429), server errors and network failures are retried with exponential backoff, honouring Retry-After. Every POST, PATCH and PUT carries an idempotency key, so a retried create never makes two transfers. What is left is raised as a typed exception with the request id to quote to support.

from pandafile import NotFoundError, RateLimitError, PandafileError

try:
    pf.transfers.retrieve("nope1234")
except NotFoundError as e:
    print("gone:", e.code)                        # resource_missing
except RateLimitError as e:
    print("slow down, retry after", e.retry_after)
except PandafileError as e:
    print(e.type, e.code, e.status, e.request_id)

Know when files are downloaded

Instead of polling, subscribe to events such as transfer.ready and transfer.downloaded. Verify each delivery against the raw body before you trust it:

from flask import Flask, request, abort
from pandafile import webhooks

app = Flask(__name__)

@app.post("/pandafile-webhook")
def hook():
    body = request.get_data()  # the raw bytes
    if not webhooks.verify(body, request.headers.get("Pandafile-Signature"), SECRET, tolerance=300):
        abort(400)
    event = request.get_json()
    return "", 200

Limits

Python uploads follow the same plan limits as the website: up to 1000 GB per transfer and 1500 GB of storage on Pro, files kept 30 days and extendable up to 90. Test transfers count toward no limit. The API reference lists every endpoint the SDK wraps, the SDKs and CLI page shows the same examples in JavaScript, and the MCP server lets AI assistants send files for you. Working in Node.js instead? See sending large files from Node.js.

Frequently asked questions

How do I send a large file from Python?

Install the official SDK with pip install pandafile, set PANDAFILE_API_KEY and call Pandafile().transfers.send(["file.mov"]). It creates the transfer, uploads with resumable tus uploads and returns the share link in result.url.

Is there an async client?

Yes. AsyncPandafile has the same resources as Pandafile, with awaitable methods and async iteration over lists, for asyncio, FastAPI and other async code.

What happens if the upload is interrupted?

Dropped connections are retried and continue at the byte the server already has. To survive a crash or a restart, save the state from on_state and pass it back as state=: finished files are skipped and the unfinished one continues.

How large can a file be?

Up to 1000 GB per transfer on Pro and Team, with 1500 GB of storage on Pro. Files are uploaded in 16 MiB chunks by default, so memory use stays small.

Which Python versions are supported?

Python 3.9 and newer. The only dependency is httpx.