Skip to main content

Dropbox connector for aisquare.pipe

Project description

aisquare-pipe-dropbox

Dropbox source and sink connectors for aisquare.pipe.

Install

pip install aisquare-pipe-dropbox

Or for development (from the repo root):

cd connectors/dropbox
pip install -e ".[dev]"

Configuration

Two authentication modes are supported:

# Mode 1: Access token (quick testing)
config = {"access_token": "sl.XXXXX"}

# Mode 2: Refresh token (recommended — auto-refreshes)
config = {
    "app_key": "YOUR_APP_KEY",
    "app_secret": "YOUR_APP_SECRET",
    "refresh_token": "YOUR_REFRESH_TOKEN",
}

Usage

Pull files from Dropbox

from aisquare.pipe import Pipeline, PullParams
from aisquare_pipe_dropbox import DropboxSource, DropboxSink

source = DropboxSource()
params = PullParams(params={
    "path": "/documents",
    "recursive": True,
    "extensions": [".pdf", ".docx"],
    "limit": 10,
})

for envelope in source.pull(config, params):
    print(f"{envelope.metadata['filename']} ({envelope.content_type})")

Push files to Dropbox

from aisquare.pipe import DataEnvelope, PushParams

sink = DropboxSink()
envelope = DataEnvelope(
    content_type="text/plain",
    data="Hello from aisquare.pipe!",
    source_id="my-app",
    metadata={"filename": "hello.txt"},
)
result = sink.push(envelope, config, PushParams(params={"target_path": "/uploads"}))
print(f"Uploaded: {result.ref}")

Pipeline (source to sink)

from aisquare.pipe import Pipeline

source = DropboxSource()
sink = DropboxSink()

pipeline = Pipeline(source=source, sink=sink)
result = pipeline.run({
    "dropbox-source": {"access_token": "SOURCE_TOKEN"},
    "dropbox-sink": {"access_token": "SINK_TOKEN"},
})
print(f"Transferred {result.success_count} files")

Features

  • Automatic MIME type detection from filenames
  • Streaming for large files (>50MB download, >140MB chunked upload)
  • Upload sessions for files up to 350GB
  • Automatic retry with exponential backoff on rate limits (429)
  • OAuth2 refresh token support with auto-refresh
  • Folder listing with pagination and recursive support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aisquare_pipe_dropbox-0.1.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

aisquare_pipe_dropbox-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file aisquare_pipe_dropbox-0.1.0.tar.gz.

File metadata

  • Download URL: aisquare_pipe_dropbox-0.1.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for aisquare_pipe_dropbox-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3b730fc9a041ffc514afbf56679c5ef33bcff4135570d932abbe71e92607123b
MD5 22ec55c10575316dbe587c90834866b5
BLAKE2b-256 4a272118bebd911f120753c2828aae54d28d0e2cf062015602f4616820b6b056

See more details on using hashes here.

File details

Details for the file aisquare_pipe_dropbox-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aisquare_pipe_dropbox-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e332c23b3c27eca8c8c83fb96b9ffee5196e9854a7bf94370dfee570111bfb45
MD5 d170e53e0c8c45afee03439a2d2e3cbf
BLAKE2b-256 c31deccd3e3ce10394b8ff4d44a1099491eaa0e1f0a01b641a3a0f2f6c6abc4a

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