Flickr的无效API响应 [英] Invalid Flickr API response

查看:517
本文介绍了Flickr的无效API响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一个很不解的问题与Flickr的API。
基本上,有一定的疑问我(和一些朋友开发商)可以运行从而导致破结果集。

基本上,你要求什么,是不是总是返回...

下面是一些例子:

请求:

<一个href=\"http://api.flickr.com/services/rest/?method=flickr.photos.search&safe_search=1&media=photos&extras=o_dims&per_page=30&page=1&format=json&nojsoncallback=1&api_key=XXXXXXX\" rel=\"nofollow\">http://api.flickr.com/services/rest/?method=flickr.photos.search&safe_search=1&media=photos&extras=o_dims&per_page=30&page=1&format=json&nojsoncallback=1&api_key=XXXXXXX

响应:

  HTTP / 1.1 200 OK
内容长度:793
日期:星期四,2012 GMT 23点30分56秒05一月
P3P:policyref =htt​​p://p3p.yahoo.com/w3c/p3p.xml,CP =曹DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDI CONI TELO OTPi我们的熟食店萨米·奥特里UNRI扑鼻IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA pre GOV
访问控制允许来源:*
缓存控制:私人
的X曾任-者:www71.flickr.mud.yahoo.com
有所不同:接受编码
连接:关闭
内容类型:text / plain的;字符集= UTF-8{照片:{页面:1,页:19886,perpage:30,总:596560,照片:[{ID:6643915631,主人: 74181952 @ N00,秘密:8bc611c556,服务器:7023,农场:8,称号:IMG_5642,ispublic:1,isfriend:0,isfamily :0},{ID:6643911681,主人:7240073 @ N04,秘密:34837024f0,服务器:7004,农场:8,称号: 26周!!,ispublic:1,isfriend:0,isfamily:0,o_width:768,o_height:1024},{id为:6643919177 主人:54899865 @ N02,秘密:170d3a336f,服务器:7153,农场:8,称号:IMGA0072,ispublic:1,isfriend :0,isfamily:0},{ID:6643916265,主人:51191328 @ N06,秘密:05905197ce,服务器:7034,农场:8 标题:IMG_1781,ispublic:1,isfriend:0,isfamily:0,o_width:2736,o_height:3648}]},统计: 好}

注意这里只有4个图像回来,当我们问30? (并有596560图片匹配)

如果我改变perpage计数不同的东西它可能工作,就像现在,如果我将其更改为3,它会返回3,但昨天当我测试,它只返回2!当我改成了10,它返回无!?

我们已经遇到另外一个例子,这次与图像尺寸数据:

请求

<$p$p><$c$c>http://api.flickr.com/services/rest/?method=flickr.interestingness.getList&extras=o_dims&per_page=3&page=1&format=rest&api_key=XXXXXXXXXX

响应

 &LT;?XML版本=1.0编码=UTF-8&GT?;
&LT;可吸入悬浮粒子STAT =OK&GT;
&LT;照片页面=1的网页=167perpage =3总=500&GT;
    &LT;照片的身份证件=6743082503所有者=29789996 @ N00秘密=7d6a1ab340服务器=7165农场=8称号=金光玛丽娜[2]ispublic =1isfriend =0isfamily =0/&GT;
    &LT;照片的身份证件=6741988715所有者=44789014 @ N04秘密=ab1528fa9f服务器=7009农场=8称号=重金属勇士ispublic =1isfriend =0isfamily = 0o_width =1200o_height =1202/&GT;
    &LT;照片的身份证件=6741320397所有者=54880604 @ N06秘密=7b3bd8530f服务器=7030农场=8称号=从下面的问候,村附近芹苴ispublic =1isfriend = 0isfamily =0/&GT;
&LT; /照片&GT;
&LT; / RSP&GT;

请注意只有其中一个图像具有图像尺寸数据。

这是一个非常棘手的问题重现,因为它只会发生飘飞,但一旦你找到了一个页面/ PAGECOUNT组合会导致一个问题,你会始终得到不正确的响应(我假设这是由于一些缓存的形式)。

有没有其他人碰到这种?
正如你在我上面的结果集看,有没有错误,没有警告,只是一个不正确的响应。

在此先感谢。
阿龙


解决方案

呵呵。我自己提起的bug;让我看进去。可能我们这边出了分页bug,或者一个缓存的事情的建议。

I've come across a very puzzling issue with the Flickr API. Basically, there's certain queries I (and some developer friends) can run which result in broken resultsets.

Basically, what you request, isn't always returned...

Here's a few examples:

Request:

http://api.flickr.com/services/rest/?method=flickr.photos.search&safe_search=1&media=photos&extras=o_dims&per_page=30&page=1&format=json&nojsoncallback=1&api_key=XXXXXXX

Response:

HTTP/1.1 200 OK
Content-Length: 793
Date: Thu, 05 Jan 2012 23:30:56 GMT
P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
Access-Control-Allow-Origin: *
Cache-Control: private
X-Served-By: www71.flickr.mud.yahoo.com
Vary: Accept-Encoding
Connection: close
Content-Type: text/plain; charset=utf-8

{"photos":{"page":1, "pages":19886, "perpage":30, "total":"596560", "photo":[{"id":"6643915631", "owner":"74181952@N00", "secret":"8bc611c556", "server":"7023", "farm":8, "title":"IMG_5642", "ispublic":1, "isfriend":0, "isfamily":0}, {"id":"6643911681", "owner":"7240073@N04", "secret":"34837024f0", "server":"7004", "farm":8, "title":"26 weeks!!", "ispublic":1, "isfriend":0, "isfamily":0, "o_width":"768", "o_height":"1024"}, {"id":"6643919177", "owner":"54899865@N02", "secret":"170d3a336f", "server":"7153", "farm":8, "title":"IMGA0072", "ispublic":1, "isfriend":0, "isfamily":0}, {"id":"6643916265", "owner":"51191328@N06", "secret":"05905197ce", "server":"7034", "farm":8, "title":"IMG_1781", "ispublic":1, "isfriend":0, "isfamily":0, "o_width":"2736", "o_height":"3648"}]}, "stat":"ok"}

Notice there's only 4 images returned, when we asked for 30? (and there's 596560 pics matching)

If I change the perpage count to something different it may work, like right now, if I change it to 3, it'll return 3, but yesterday when I was testing, it only returned 2! and when I changed it to 10 it returned none!?

We've come across another example, this time with image size data:

Request

http://api.flickr.com/services/rest/?method=flickr.interestingness.getList&extras=o_dims&per_page=3&page=1&format=rest&api_key=XXXXXXXXXX

Response

<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
<photos page="1" pages="167" perpage="3" total="500">
    <photo id="6743082503" owner="29789996@N00" secret="7d6a1ab340" server="7165" farm="8" title="Glittering Marina [2]" ispublic="1" isfriend="0" isfamily="0" />
    <photo id="6741988715" owner="44789014@N04" secret="ab1528fa9f" server="7009" farm="8" title="Heavy metal warrior" ispublic="1" isfriend="0" isfamily="0" o_width="1200" o_height="1202" />
    <photo id="6741320397" owner="54880604@N06" secret="7b3bd8530f" server="7030" farm="8" title="Greetings from below, Village near Can Tho" ispublic="1" isfriend="0" isfamily="0" />
</photos>
</rsp>

Note only one of the images has image size data.

It's a very difficult issue to reproduce as it only happens every now and then, but once you've found a page/pagecount combo that causes an issue, you'll consistently get the incorrect response (I assume it's due to some form of caching).

Has anyone else come across this? As you can see in my resultset above, there's no error, no warning, just an incorrect response.

Thanks in advance. Aaron

解决方案

Huh. I've filed myself a bug; let me look into it. Possibly a pagination bug on our end, or a caching thing as suggested.

这篇关于Flickr的无效API响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆