Utilities to read/write python objects to/from dropbox
Project description
vdropbox
Utilities to read/write objects to/from Dropbox.
📦 Installation
pip install vdropbox
# With pandas support (csv/excel/parquet helpers)
pip install vdropbox[pandas]
🚀 Usage
The first step is to declare the Vdropbox object using a token:
from vdropbox import Vdropbox
vdp = Vdropbox("my_secret")
Unlike the official dropbox Python package, it is not required to have a leading / in all file names.
[!NOTE] Ensure your Dropbox token has the necessary permissions.
🛠 Custom Logger
You can pass a custom logger to Vdropbox if you want to control logging behavior:
import logging
from vdropbox import Vdropbox
logger = logging.getLogger("my_logger")
vdp = Vdropbox("my_secret", logger=logger)
[!TIP] Using a custom logger allows you to integrate
Vdropboxlogs into your existing logging setup.
🔄 Automatic Retries
Transient errors (connection drops, timeouts, Dropbox 5xx, rate limits) are retried automatically with exponential backoff. You can tune or disable it:
vdp = Vdropbox("my_secret", max_retries=4) # default; use 0 to disable
📁 Basic Functions
# Check if a file exists
vdp.file_exists("my_file.txt")
vdp.file_exists("folder/my_file.txt")
# Check contents of a folder
vdp.ls("my_folder")
# List all files recursively (returns paths relative to the folder)
vdp.ls("my_folder", recursive=True)
# Create a folder (and missing parents)
vdp.mkdir_p("folder/subfolder")
# Move/rename a file
vdp.move("my_file.txt", "folder/my_file.txt")
# Delete a file
vdp.delete("my_file.txt")
[!WARNING] Deleting a file is irreversible!
📝 Reading and Writing Text Files
data = "Hello world"
# Write a text file
vdp.write_file(data, "my_file.txt")
# Read a text file
vdp.read_file("my_file.txt")
[!NOTE] The default encoding is UTF-8.
📜 Reading and Writing YAML Files
data = {"a": 4, "b": 2}
# Write a YAML file
vdp.write_yaml(data, "my_file.yaml")
# Read a YAML file
vdp.read_yaml("my_file.yaml")
[!TIP] YAML files are written with
sort_keys=False, so key order is preserved.
🧾 Reading and Writing JSON Files
data = {"a": 4, "b": 2}
# Write a JSON file
vdp.write_json(data, "my_file.json")
# Read a JSON file
vdp.read_json("my_file.json")
📊 Reading and Writing Excel Files with Pandas
import pandas as pd
# Create a dummy DataFrame
df = pd.DataFrame(list("ABCDE"), columns=["col"])
# Write an Excel file
vdp.write_excel(df, "df.xlsx")
# Read an Excel file
df = vdp.read_excel("df.xlsx")
[!TIP] You can pass keyword arguments to
pd.read_excelordf.to_excel.
Example:
vdp.write_excel(df, "test.xlsx", index=False)
🔹 Reading and Writing Parquet Files with Pandas
import pandas as pd
# Create a dummy DataFrame
df = pd.DataFrame(list("ABCDE"), columns=["col"])
# Write a Parquet file
vdp.write_parquet(df, "df.parquet")
# Read a Parquet file
df = vdp.read_parquet("df.parquet")
[!TIP] You can pass keyword arguments to
pd.read_parquetordf.to_parquet.
👥 Authors
📜 License
The content of this repository is licensed under MIT.
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 vdropbox-2.0.0.tar.gz.
File metadata
- Download URL: vdropbox-2.0.0.tar.gz
- Upload date:
- Size: 63.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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 |
10dcc48133cce66077d31725dc9c8d0c70532bdb64c035c1defad70d1d68002c
|
|
| MD5 |
e1040f043e334006b9b1fa4652f68a50
|
|
| BLAKE2b-256 |
6798efdee23828cd0dde500554b6cca4b181e42c6b9af096e15eafe6ca5f2330
|
File details
Details for the file vdropbox-2.0.0-py3-none-any.whl.
File metadata
- Download URL: vdropbox-2.0.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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 |
8d1d245b44535304141c38d2fbc2f069cddbe3c3d218cd2a2c9a29be80ad2b96
|
|
| MD5 |
4f05e73f26fab178ebbbd3a78bae8481
|
|
| BLAKE2b-256 |
fb886fd3bcf5cc799daf493c0ff5d554c5839b0d9cc4271f9bdbf0bb894c4ac9
|