wsgi application

def application(env, start_response):
    """wsgi application
    """
    path = env["PATH_INFO"]

    if path == "/influx.gif":
        # send response
        start_response("200 OK", [("Content-Type", "image/gif")])
        yield GIF
        # parse the query params and stick them in the queue
        params = parse_qs(env["QUERY_STRING"])
        try:
            site = params.get("site", [""])[0]
            content_id = params.get("content_id", [""])[0]
            event = params.get("event", [""])[0]
            path = params.get("path", [""])[0]
            EVENTS_QUEUE.put((site, content_id, event, path))
        except Exception as e:
            LOGGER.exception(e)

    elif path == "/pageviews.json":
        params = parse_qs(env["QUERY_STRING"])
        data, status = pageviews(params)
        start_response(status, [("Content-Type", "application/json")])
        yield data

    elif path == "/embedviews.json":
        params = parse_qs(env["QUERY_STRING"])
        data, status = embedviews(params)
        start_response(status, [("Content-Type", "application/json")])
        yield data

    elif path == "/contentids.json":
        params = parse_qs(env["QUERY_STRING"])
        data, status = content_ids(params)
        start_response(status, [("Content-Type", "application/json")])
        yield data

    elif path == "/trending.json":
        params = parse_qs(env["QUERY_STRING"])
        data, status = trending(params)
        start_response(status, [("Content-Type", "application/json")])
        yield data

    elif path == "/videoplays.json":
        params = parse_qs(env["QUERY_STRING"])
        data, status = videoplays(params)
        start_response(status, [("Content-Type", "application/json")])
        yield data

    elif path == "/embedplays.json":
        params = parse_qs(env["QUERY_STRING"])
        data, status = embedplays(params)
        start_response(status, [("Content-Type", "application/json")])
        yield data

    else:
        start_response("404 Not Found", [("Content-Type", "text/plain")])
        yield "Nothing Here"