Exemplo n.º 1
0
def detailAmazon(request):

    if all(k in request.GET for k in ("asin", "response_group")):

        # get request parameters
        asin = request.GET.get("asin")
        responseGroup = request.GET.get("response_group")

        # get amazon detail response
        response = Amazon.detailAmazon(asin, responseGroup)

        return HttpResponse(response, mimetype="application/xml")

    else:
        return HttpResponse("missing_param", mimetype="text/plain", status="500")
Exemplo n.º 2
0
def detailAmazon(request):

    if all(k in request.GET for k in ('asin', 'response_group')):

        # get request parameters
        asin = request.GET.get('asin')
        responseGroup = request.GET.get('response_group')

        # get amazon detail response
        response = Amazon.detailAmazon(asin, responseGroup)

        return HttpResponse(response, mimetype='application/xml')

    else:
        return HttpResponse('missing_param', mimetype='text/plain', status='500')
Exemplo n.º 3
0
def searchAmazon(request):

    if all(k in request.GET for k in ("keywords", "browse_node", "response_group", "search_index", "page")):

        # get request parameters
        keywords = request.GET.get("keywords")
        browseNode = request.GET.get("browse_node")
        responseGroup = request.GET.get("response_group")
        searchIndex = request.GET.get("search_index")
        page = request.GET.get("page")

        # search amazon
        response = Amazon.searchAmazon(keywords, browseNode, responseGroup, searchIndex, page)

        return HttpResponse(response, mimetype="application/xml")
    else:
        return HttpResponse("missing_param", mimetype="text/plain", status="500")
Exemplo n.º 4
0
def searchAmazon(request):

    if all(k in request.GET for k in ('keywords', 'browse_node', 'response_group', 'search_index', 'page')):

        # get request parameters
        keywords = request.GET.get('keywords')
        browseNode = request.GET.get('browse_node')
        responseGroup = request.GET.get('response_group')
        searchIndex = request.GET.get('search_index')
        page = request.GET.get('page')

        # search amazon
        response = Amazon.searchAmazon(keywords, browseNode, responseGroup, searchIndex, page)

        return HttpResponse(response, mimetype='application/xml')
    else:
        return HttpResponse('missing_param', mimetype='text/plain', status='500')