Skip to main content

Utilities to read/write python objects to/from dropbox

Project description

vdropbox

Utilities to read/write objects to/from Dropbox.

🚀 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 Vdropbox logs into your existing logging setup.

📁 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")

# 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] Internally, it uses oyaml, so all YAML files maintain their order.

📊 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_excel or df.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_parquet or df.to_parquet.

👥 Authors

📜 License

The content of this repository is licensed under MIT.

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

vdropbox-1.1.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

vdropbox-1.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file vdropbox-1.1.1.tar.gz.

File metadata

  • Download URL: vdropbox-1.1.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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 vdropbox-1.1.1.tar.gz
Algorithm Hash digest
SHA256 6f9cfdb11084d48c11b17f1d11728fcbe007633ee93d88d762a87ab60f05d35a
MD5 6ffb913e2f6b8ff7fbcc2dcb57f539d5
BLAKE2b-256 2947852df9f58a24a5ca1d1bc07892859970875776acd82b2ad3b6751c8ec671

See more details on using hashes here.

File details

Details for the file vdropbox-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: vdropbox-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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 vdropbox-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fc68edf5e7112bf70bd5763b187baaaec71ced3419f44d68f805fb8205e2bd84
MD5 78f7e2fae15311967c34102daa5d1eed
BLAKE2b-256 363c96f8562576b92d30effae2daae1261dc837c0093492259c6fa36697b4c6e

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