0

I use Flickr to load images into my app using the Picasso library. It was working up until about 2 months ago with no issue. I have not changed anything in my code having to do with images since it was working. I have a feeling Flickr changed something on their end but it makes no sense because the first image loads and none of the rest.

I get this error: com.squareup.picasso.NetworkRequestHandler$ResponseException: HTTP 503

I really don't think this is my code but here is a snippet:

Picasso.get()
       .load(FlickrDirectURL)
       .placeholder(R.drawable.XXXXX)
       .error(R.drawable.XXXXX)
       .into(Picture, new Callback() 
       {
               @Override
               public void onSuccess(){}
    
               @Override
               public void onError(Exception e)
               {
                     Log.e("Picasso",""+e);
               }
        });

Any help would be greatly appreciated. Even a direction to go would help. Thanks!

2 Answers2

0

Any HTTP 500 Response is a server side error. A HTTP 503 is 'Service Unavailable'. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503

Have you tried printing out the your 'FlickrDirectURL' variable, to see what the URL is? If it looks correct I'd then put in a browser and see what you get. If you get your image, than it could be Picasso. But I'd bet you have a malformed URL. Looking at the documentation (XML Responses? yuck.) I don't see anything about a 503 error response.
https://www.flickr.com/services/api/

https://www.flickr.com/services/api/misc.urls.html

JonR85
  • 700
  • 4
  • 12
0

Thanks for everyone's help. To fix this problem, I switched the Library to Glide. This fixed the problem without changing anything else. Thanks Sudarshan for the Library suggestion.

Glide
      .with(Context)
      .load(URL)
      .error(R.drawable.XXXXX)
      .placeholder(R.drawable.XXXXX)
      .listener(new RequestListener<Drawable>()
                {
                    @Override
                    public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) 
                    {
                        Log.e("Glide", "Error Loading Image", e);
                        return false;
                    }

                    @Override
                    public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource)
                    {
                        Log.e("Glide", "Image Loaded");
                        return false;
                    }
                })
      .into(Picture);