Trovebox Python Library
(Previously known as openphoto-python)
This library works with any Trovebox server, either self-hosted, or using the hosted service at trovebox.com. It provides full access to your photos and metadata, via a simple Pythonic API.
Installation
pip install trovebox
Documentation
See the Trovebox API Documentation for full API documentation, including Python examples.
All development takes place at the openphoto-python GitHub site.
Credentials
For full access to your photos, you need to create the following config file in ~/.config/trovebox/default:
# ~/.config/trovebox/default host = your.host.com consumerKey = your_consumer_key consumerSecret = your_consumer_secret token = your_access_token tokenSecret = your_access_token_secret
The config_file switch lets you specify a different config file.
To get your credentials:
Log into your Trovebox site
Click the arrow on the top-right and select ‘Settings’
Click the ‘Create a new app’ button
Click the ‘View’ link beside the newly created app
Using the library
from trovebox import Trovebox client = Trovebox() photos = client.photos.list() photos[0].update(tags=["tag1", "tag2"]) print(photos[0].tags)
The Trovebox Python class hierarchy mirrors the Trovebox API endpoint layout. For example, the calls in the example above use the following API endpoints:
client.photos.list() -> /photos/list.json
photos[0].update() -> /photo/<id>/update.json
You can also access the API at a lower level using GET/POST methods:
resp = client.get("/photos/list.json")
resp = client.post("/photo/62/update.json", tags=["tag1", "tag2"])
API Versioning
It may be useful to lock your application to a particular version of the Trovebox API. This ensures that future API updates won’t cause unexpected breakages. To do this, configure your Trovebox client as follows:
client.configure(api_version=2)
SSL Verification
If you connect to your Trovebox server over HTTPS, its SSL certificate is automatically verified. You can configure your Trovebox client to bypass this verification step:
client.configure(ssl_verify=False)
Commandline Tool
You can run commands to the Trovebox API from your shell!
These are the options you can pass to the shell program:
--help # Display help text -c config_file # Either the name of a config file in ~/.config/trovebox/ or a full path to a config file -h hostname # Overrides config_file for unauthenticated API calls -e endpoint # [default=/photos/list.json] -X method # [default=GET] -F params # e.g. -F 'title=my title' -F 'tags=mytag1,mytag2' -p # Pretty print the json -v # Verbose output --version # Display the current version information
Commandline Examples
Upload a public photo to the host specified in `~/.config/trovebox/default`:
trovebox -p -X POST -e /photo/upload.json -F 'photo=@/path/to/photo/jpg' -F 'permission=1'
{
"code":201,
"message":"Photo 1eo uploaded successfully",
"result":{
"actor":"user@example.com",
"albums":[],
...
...
}
}
Get a thumbnail URL from current.trovebox.com (unauthenticated access):
trovebox -h current.trovebox.com -p -e /photo/62/view.json -F 'returnSizes=20x20'
{
"code":200,
"message":"Photo 62",
"result":{
"actor":"",
"albums":[
"1"
],
...
...
"path20x20":"http://current.trovebox.com/photo/62/create/36c0a/20x20.jpg",
"pathBase":"http://awesomeness.trovebox.com/base/201203/7ae997-Boracay-Philippines-007.jpg",
"permission":"1",
"photo20x20":[
"http://current.trovebox.com/photo/62/create/36c0a/20x20.jpg",
13,
20
],
...
...
}
}
Metadata
Release files for trovebox 0.6.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| trovebox-0.6.2.tar.gz | 16.3 kB | Without provenance | Details for trovebox-0.6.2.tar.gz |
Release files / trovebox-0.6.2.tar.gz
| Download URL | trovebox-0.6.2.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f5b5873ea81fa2fda7cac1fd425420e8447402b7ae7a01ba415a9c6a0f2e99d
|
|
BLAKE2b-256 checksum How to use checksums |
f04c8b5ac553f2d40038e846eef1446960dfd018f9ff7bdf7f15943bf24e6672
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for trovebox 0.6.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.