Example #1
0
## Load configuration from file
config = OptConfigReader()
config.setup()

## start the logger
Logger().setup()

###########################

# init of the flickr api
api = API()

if user:
    user = api.getUserFromAll()
    page.h3(user['username'], onclick='alert("'+user['id']+'");')
    page.a('rss', href='rss.py?user_id=%s'%(user['id']),)
    page.br()
    photos = api.getUserPhotos(user['id'])
    existing = Existing().grepPhotosExists(photos)
    existing_ids = map(lambda e:e['id'], existing)
    urls = api.getPhotoURLFlickr(photos, True, True)
    for id in urls:
        if id in existing_ids:
            style = 'border:1px red solid;'
        else:
            style = 'border:1px blue solid;'
        page.img(src=urls[id], width=100, height=80, alt=id, onclick='alert("'+id+'");', style=style)
else:
    page.h3("showing last photos of your contacts")
###########################################

form = cgi.FieldStorage()
if 'user_id' in form:
    user_id = form['user_id'].value
else:
    user_id = '53753127@N03'

user = getUserFromID(api, user_id)
username = user['username']

page = FDH_page()
page.init(css = ('pouet.css'))

page.h3("Welcome %s"%username)

import md5
def signature(api, arguments):
    return md5.md5(api.secret + arguments.replace('=', '').replace('&', '')).hexdigest()


args = {
    'user_id':user_id,
    'format':'json',
    'nojsoncallback':'1',
    'auth_token':token,
    'api_key':api.key
}
#url = 'http://api.flickr.com/services/feeds/activity/all' #?user_id=%s&format=csv'%user_id
#url = 'http://api.flickr.com/services/feeds/activity/all?user_id=%s&format=json&auth_token=%s&nojsoncallback=1&secret=%s'%(user_id, token, api.secret)