开发者

flickrj PhotosetsInterface.getPhotos

开发者 https://www.devze.com 2023-04-04 16:30 出处:网络
i think i successfully using flickrj before, but i am stuck this time. Flickr flickr = new Flickr(\"apikey\");

i think i successfully using flickrj before, but i am stuck this time.

Flickr flickr = new Flickr("apikey");
        PhotosetsInterface photosetInterface = flickr.getPhotosetsInterface();
        PhotoList photos = null;
        try {
            photos = photosetInterface.getPhotos("setKey",10,1);
            Iterator<Photo> itr = photos.iterator();
            while(itr.hasNext()){
                Photo photo = (Photo) itr.next();
                out.println("the url of the photo is "+photo.getTitle()+"<br/>");
            }
        } catch (SAXException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (FlickrException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

when i run this i got this error ad below, i am using google appengine.

com.aetrion.flickr.FlickrException: 96: Invalid signature
    at com.aetrion.flickr.photosets.PhotosetsInterface.getPhotos(PhotosetsInterface.java:437)
    at com.aetrion.flickr.photosets.PhotosetsInterface.getPhotos(PhotosetsInterface.java:479)
    at dassio.FlickrPage.doGet(FlickrPage.java:34)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.devel开发者_Python百科opment.BackendServersFilter.doFilter(BackendServersFilter.java:97)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:351)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

i am able to contact with the endpoint and get the set list so i really don't know why a Invalid signature.


find the problem you have to provide secret key with the Flikcr construction method:

Flickr flickr = new Flickr("apikey","secretkey");


I found these examples here really helpful to get started with the flickrj api.

https://github.com/mohlendo/flickrj/tree/master/examples

0

精彩评论

暂无评论...
验证码 换一张
取 消