A Python OAuth client for OpenPhoto
Python Shell
Failed to load latest commit information.
bin Renamed OpenPhoto to Trovebox Jul 19, 2013
tests Merge branch 'sneakypete81-unicode_tags' into development Feb 2, 2014
trovebox Bump to v0.6.1 Feb 2, 2014
.coveragerc Add coverage.py configuration Aug 29, 2013
.gitignore Add coverage.py configuration Aug 29, 2013
.travis.yml Use pylint-patcher rather than my forked version of Pylint Sep 7, 2013
CHANGELOG Bump to v0.6.1 Feb 2, 2014
LICENSE Fix #9 - include LICENSE file Apr 16, 2012
MANIFEST.in Add MANIFEST.in, to be totally sure that README.rst gets packaged Aug 16, 2013
README.rst Add coveralls badge to README.rst Nov 23, 2013
run_functional_tests Remove APIv1 test server from functional tests. Sep 14, 2013
tox.ini Run unit tests under PyPy too Feb 2, 2014


Trovebox Python Library

(Previously known as openphoto-python)

Build Status Coverage Status Python Package Index (PyPI)

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.


pip install trovebox


See the Trovebox API Documentation for full API documentation, including Python examples.

All development takes place at the openphoto-python GitHub site.


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

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:


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:


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'
    "message":"Photo 1eo uploaded successfully",

Get a thumbnail URL from current.trovebox.com (unauthenticated access):

trovebox -h current.trovebox.com -p -e /photo/62/view.json -F 'returnSizes=20x20'
    "message":"Photo 62",