Exemplo n.º 1
0
def check_status():
    """
    This will check status for upc
    although the person should be notified by email

    Possible feature: count of times upc has been checked
    """

    request_data = json.loads(request.data)
    distributor = request_data.pop('distributor', False)
    assert distributor, "No distributor provided"
    results = Lookup.lookup_by_distributor(distributor, **request_data)
    return json.dumps({
        'status': 'OK',
        'results': results
        })
Exemplo n.º 2
0
def check_is_live(distributor):
    """
    Directly checks status
    """
    upc = request.args.get('upc')
    artist = request.args.get('artist')
    album_title = request.args.get('album_title')

    distributor = distributor.lower()

    if distributor in ['amazon', 'deezer', 'google']:
        if not artist or not album_title:
            return json.dumps({
                'status': 'error',
                'message': 'Amazon lookup requires both artist and album title'
                })

    results = Lookup.lookup_by_distributor(distributor, upc=upc, artist=artist,
        title=album_title)

    return json.dumps(results)