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.2.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.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vdropbox-1.1.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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.2.tar.gz
Algorithm Hash digest
SHA256 743eda42f5dcbaeccc5818d9cb523e25c92d8a5dba7a161f51a3ce002b278862
MD5 a6d6f0066cf0edeae9bb19f69125f189
BLAKE2b-256 afd1c13f6fc47ef726ae82794e572513ddaa78a07dc122d588f4f6321106b96a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vdropbox-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0f6dae549b406bc69cb41b9a0c236231f1e7c1ef03371a67361e07295536a100
MD5 d7d0ed09f480d9ec73804c3c5ffeed14
BLAKE2b-256 8192946896be471fc10b64f0ac2d6a16d800e8d2f413d1dfc9537f869af8de39

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