views:

32

answers:

0

Hello ,

I am using Django-pipes to parse Bing Image Search API , everything is going very smooth thu i can't render Thumbnail data

Json : http://api.search.live.net/json.aspx?Web.Count=10&query=linux&sources=image&Appid=APPID

Model.py

class BingImageSearch(pipes.Pipe):

uri = "http://api.search.live.net/json.aspx"

@staticmethod

def fetch(q):
    appid='8DEC81ED9C8638F24E7895166578016732307C41'
    sources="image"
    resp = BingSearch.objects.get({'Appid':appid,'query':q,'sources':sources,'Web.Count':10})

    return resp.SearchResponse.Image.Results

View.py

def search(request):
if 'q' in request.GET and request.GET['q']:
    q = request.GET['q']
    results = BingImageSearch.fetch(q)
    return render_to_response("index.html", {'results':results,'q':q})
else:
    return render_to_response('index.html', {'error': True},context_instance=RequestContext(request))

and Template file :

        <h1>Search results for {{ q }}</h1>


    {% for result in results %}

    <h3><a href="#">{{ result.Title }}</a></h3>
    <a href="{{ result.MediaUrl }}"><img src="{{ result.Thumbnail.Url }}" /></a>

    {{ result.Url }}

    <p>{{result.Description}}{{result.DateTime}}</p>

    {% endfor %}

{{result.Thumbnail.url}} is not displaying the thumbnail url ! how i can display thumbnail !