Cheers Guys,

I went the simplejson route, I was wondering is there much difference
performance wise in the way you've removed the jsonp text, I've done
it this way:

...
    data = urlfetch.fetch(url, headers={},
payload=params,method=urlfetch.POST)
    json = re.search ('{.*}', data.content )
    obj = simplejson.loads(json.group(0), 'iso8859-1')
...

Cheers again.  =0)

On 23 Aug, 13:18, Anthoni <anthoni.gard...@gmail.com> wrote:
> Hi veearrsix,
>
> Like vp mentioned above, the fastest way to query flickr is to use
> their json api,
> Below is some code that I use in one of my Google Wave Robots to do
> such a thing, hope it helps.
> The code was given in the Robots group and is not mine, but it does
> work.
>
> [code]
> def searchFlickr(query):
>     results = []
>     url = 'http://api.flickr.com/services/rest/?
> method=flickr.photos.search&api_key=13b98c74bedac9150a428e87bc782e81&format=json&per_page=5&text=
> %s' % (urllib.quote(query))
>     content = urlfetch.fetch(url=url).content
>     content =content[:-1].replace("jsonFlickrApi(","")
>     for item in simplejson.loads(content)['photos']['photo']:
>         results.append('http://farm'+str(item['farm'])
> +'.static.flickr.com/'+str(item['server'])+'/'+str(item['id'])+'_'+str
> (item['secret'])+'_m.jpg')
>
>     return results
> [/code]
>
> Note, you will need a simplejson, urlfetch and urllib imports in order
> for it to work.
>
> Regards
> Anthoni
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to