def __init__(self, read_command_line=True): config = OptConfigReader() config.setup() opt = OptReader() ret = opt.read(read_command_line) if read_command_line and ret: return ret Logger().setup() Logger().warn("##########################################################") Logger().warn("%s (running as %s)" % (" ".join(sys.argv), os.getpid())) Logger().debug("LANG is %s" % os.environ.get("LANG")) proxy = FDHProxySettings() proxy.setValues(OPT) proxy.activate() # init of the flickr api token = initialisationFlickrApi(OPT) if not isinstance(token, (list, tuple)) or len(token) != 2: if token != 6: Logger().error("Couldn't init flickr api") Logger().error(token) raise Exception("Couldn't init flickr api %s" % (token,)) self.api, self.token = token
from flickr_download_helper.web_api import PhotoManager, PF from flickr_download_helper.local_proxy import LocalProxy from flickr_download_helper.html_widget import FDH_page import urllib import cgi config = OptConfigReader() config.setup() ## start the logger Logger().setup() proxy = FDHProxySettings() proxy.setValues(OPT) proxy.activate() form = cgi.FieldStorage() page_num = 0 perpage = 25 user_id = '' if 'page_num' in form: page_num = int(form['page_num'].value) if 'perpage' in form: perpage = int(form['perpage'].value) if 'user_id' in form: user_id = form['user_id'].value ########################################### def display_photo(page, photo): id = photo['id'] user_id = photo['contact']['nsid']