コード例 #1
0
ファイル: views.py プロジェクト: sunjiesh/PythonShowcase
def getWallpaper(request,keywords):
    """
        请求
    """
    download=request.GET.get('download')
    print keywords
    picUrl=''
    if keywords=='bing':
        picUrl=wallpaper.bingcn()
    else:
        print u'暂不支持此关键字查询'
        return HttpResponse(u'暂不支持此关键字查询')
    if picUrl!='':
        if download!=None and download.lower()=='true':
            imageBytes=httputil.downloadFile(picUrl)
            return HttpResponse(imageBytes, mimetype="image/jpeg")
        else:
            return HttpResponse(picUrl)
    else:
        return HttpResponse(u'找不到结果')
コード例 #2
0
def getWallpaper(request, keywords):
    """
        请求
    """
    download = request.GET.get("download")
    print keywords
    picUrl = ""
    if keywords == "bing":
        picUrl = wallpaper.bingcn()
    else:
        print u"暂不支持此关键字查询"
        return HttpResponse(u"暂不支持此关键字查询")
    if picUrl != "":
        if download != None and download.lower() == "true":
            imageBytes = httputil.downloadFile(picUrl)
            return HttpResponse(imageBytes, mimetype="image/jpeg")
        else:
            return HttpResponse(picUrl)
    else:
        return HttpResponse(u"找不到结果")
コード例 #3
0
ファイル: views.py プロジェクト: sunjiesh/PythonShowcase
def downloadPic(request):
    path=request.GET.get('path')
    print path
    if path!='':
        imageBytes=httputil.downloadFile(path)
    return HttpResponse(imageBytes, mimetype="image/jpeg")
コード例 #4
0
def downloadPic(request):
    path = request.GET.get("path")
    print path
    if path != "":
        imageBytes = httputil.downloadFile(path)
    return HttpResponse(imageBytes, mimetype="image/jpeg")