| 2209 | return results |
| 2210 | |
| 2211 | class FlickrResult(Result): |
| 2212 | |
| 2213 | @property |
| 2214 | def url(self): |
| 2215 | # Retrieving the url of a FlickrResult (i.e. image location) requires another query. |
| 2216 | # Note: the "Original" size no longer appears in the response, |
| 2217 | # so Flickr might not like it if we download it. |
| 2218 | url = FLICKR + "?method=flickr.photos.getSizes&photo_id=%s&api_key=%s" % (self._id, self._license) |
| 2219 | data = URL(url).download(throttle=self._throttle, unicode=True) |
| 2220 | data = xml.dom.minidom.parseString(bytestring(data)) |
| 2221 | size = { TINY: "Thumbnail", |
| 2222 | SMALL: "Small", |
| 2223 | MEDIUM: "Medium", |
| 2224 | LARGE: "Original" }.get(self._size, "Medium") |
| 2225 | for x in data.getElementsByTagName("size"): |
| 2226 | if size == x.getAttribute("label"): |
| 2227 | return x.getAttribute("source") |
| 2228 | if size == "Original": |
| 2229 | url = x.getAttribute("source") |
| 2230 | url = url[:-len(extension(url))-2] + "_o" + extension(url) |
| 2231 | return u(url) |
| 2232 | |
| 2233 | #images = Flickr().search("kitten", count=10, size=SMALL) |
| 2234 | #for img in images: |
no outgoing calls
no test coverage detected
searching dependent graphs…