Command-line tool and library for PicDB API, which provides storage for images.
Project description
PicDB-Python
PicDB is a Python package that provides both a command-line tool and a library for interacting with the PicDB API. It allows you to upload files, upload from URLs, and download files using the API.
Features
- Upload a local file to PicDB.
- Upload a file from a URL to PicDB.
- Download a file from PicDB using its file ID.
- Command-line tool to perform these operations from the terminal.
Installation
To install the picdb package, you can use pip:
pip install picdb
This will install the package and make the picdb command-line tool available.
Usage
Command-Line Tool
The picdb command-line tool allows you to perform various operations directly from the terminal.
Help
To see available commands and options, use:
picdb help
Upload a Local File
To upload a file from your local machine:
picdb upload -f "path/to/your/file.png"
Upload a File from a URL
To upload a file from a URL:
picdb upload -l "https://example.com/image.png"
Download a File
To download a file from PicDB using its file ID:
picdb download <file_id> -f "path/to/save/directory"
Library Usage
You can also use the picdb package as a library in your Python scripts.
Example Usage
from picdb import upload_file, upload_link, download_file_id
# Upload a local file
response = upload_file("./tests/test.png")
print("Upload response:", response)
# Upload a file from a link
response = upload_link("https://example.com/image.png")
print("Upload response:", response)
# Download a file using its file ID
download_file_id("file_id_here", "./downloads")
print("Download completed!")
Development
Running Tests
A test script (test_cli.py) is provided to test the command-line interface:
python test_cli.py
Make sure the necessary test files are available (e.g., a test file for upload testing).
Requirements
- Python 3.6 or higher
requestslibrary (automatically installed with the package)
Installation from Source
To install the package from the source code:
- Clone the repository:
git clone https://github.com/yourusername/picdb.git
- Navigate to the project directory:
cd picdb
- Install the package:
pip install .
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 py-picdb-0.1.0.tar.gz.
File metadata
- Download URL: py-picdb-0.1.0.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54c0039adcbddde680044bd320e6661649baf6c28793d139820e51d743a63e88
|
|
| MD5 |
ad70f031344def4b8859320489edc9d2
|
|
| BLAKE2b-256 |
c20ab9fcf9bd21a93a4f5d52cc8ebe1a5d35cc018858076cad37be081ae3c6ca
|
File details
Details for the file py_picdb-0.1.0-py3-none-any.whl.
File metadata
- Download URL: py_picdb-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d6b9d9bc5d75933bb709cf9eba838fa32090a541d5f2831ce9449d05e2d363b
|
|
| MD5 |
2d2ea0639154af3b2ba90803f39e8766
|
|
| BLAKE2b-256 |
0a1c946bc1edf38056f33a24859a9b189ee634143d77e5952334c9d6f45a005b
|