예제 #1
0
def main():
    try:
        client = Trovebox()
        client.configure(api_version=2)

    except IOError, e:
        print
        print '!! Could not initialize Trovebox connection.'
        print '!! Check that ~/.config/trovebox/default exists and contains proper information.'
        print
        raise e
예제 #2
0
Created by Magnus Wahlberg on 2013-11-27.
Copyright (c) 2012 Wahlberg Research And Development. All rights reserved.
"""

import os
import sys
import imghdr
import hashlib
import argparse
from trovebox import Trovebox
from trovebox.errors import TroveboxError, TroveboxDuplicateError

# Init
try:
    client = Trovebox()
    client.configure(api_version=2)

except IOError, E:
    print 'Could not connect to Trovebox'
    print 'Please check ~/.config/trovebox/default.'
    print 'More info: https://github.com/photo/openphoto-python'
    raise E

def is_folder(path):
    return os.path.isdir(path)


def image_uploaded(photo, return_data=False):
    res = client.photos.list(hash=hash_file(photo))

    if return_data:
예제 #3
0
                      token=config.token, token_secret=config.token_secret)
  else:
    try:
      client = Trovebox(config_file=config.config)
    except IOError as error:
      print error
      print
      print "You must create a configuration file in ~/.config/trovebox/default"
      print "with the following contents:"
      print "    host = your.host.com"
      print "    consumerKey = your_consumer_key"
      print "    consumerSecret = your_consumer_secret"
      print "    token = your_access_token"
      print "    tokenSecret = your_access_token_secret"
      print
      print "To get your credentials:"
      print " * Log into your Trovebox site"
      print " * Click the arrow on the top-right and select 'Settings'."
      print " * Click the 'Create a new app' button."
      print " * Click the 'View' link beside the newly created app."
      print
      print error
      sys.exit(1)

  if config.disable_ssl_verify:
    client.configure(ssl_verify=False)

  # check if a fetched directory exist else create it
  createDirectorySafe('fetched')
  fetch(client)