Ejemplo n.º 1
0
def searchRedirect(request, tags='', num=1, nsid=''):
    if not num or not num.isdigit() or int(num) <= 0:
        num = 1
    resp = HttpResponse(status=302)
    nsid = getUserNSID(request, resp, apiKey, nsid)
    photo = flickrapi.getPhotoBySearch(apiKey, nsid, tags, num)
    destinationUrl = flickrapi.getPhotoPageUrl(photo, nsid)
    resp['Title'] = photo.title.encode("utf-8")
    resp['Location'] = destinationUrl
    return resp
Ejemplo n.º 2
0
def redirect(request, nsid, num, popular):
    if not num or not num.isdigit() or int(num) <= 0:
        num = 1
    if not popular:
        popular = ''

    resp = HttpResponse(status=302)
    nsid = getUserNSID(request, resp, apiKey, nsid)
    photo = flickrapi.getPhoto(apiKey, nsid, num, popular)
    destinationUrl = flickrapi.getPhotoPageUrl(photo, nsid)
    resp['Title'] = photo.title.encode("utf-8")
    resp['Location'] = destinationUrl
    return resp