def GET_check_inventory(self, responder, sr, location, start, end): sr = sr or Frontpage if not location or not location.country: available = inventory.get_available_pageviews(sr, start, end, datestr=True) else: available = inventory.get_available_pageviews_geotargeted(sr, location, start, end, datestr=True) return {'inventory': available}
def GET_check_inventory(self, responder, sr, location, start, end): sr = sr or Frontpage if not location or not location.country: available = inventory.get_available_pageviews(sr, start, end, datestr=True) elif sr == Frontpage or c.user_is_sponsor: available = inventory.get_available_pageviews_geotargeted(sr, location, start, end, datestr=True) else: return abort(403, 'forbidden') return {'inventory': available}
def GET_check_inventory(self, responder, sr, collection, location, start, end): if collection: target = Target(collection) sr = None else: sr = sr or Frontpage target = Target(sr.name) if not allowed_location_and_target(location, target): return abort(403, 'forbidden') available = inventory.get_available_pageviews( target, start, end, location=location, datestr=True) return {'inventory': available}
def GET_check_inventory(self, responder, sr, collection, location, start, end): if collection: target = Target(collection) sr = None else: sr = sr or Frontpage target = Target(sr.name) if not location or not location.country: available = inventory.get_available_pageviews(target, start, end, datestr=True) elif not collection and (sr == Frontpage or c.user_is_sponsor): # geotargeting is available on the Frontpage for all users or on # individual subreddits for sponsors available = inventory.get_available_pageviews_geotargeted(sr, location, start, end, datestr=True) else: return abort(403, "forbidden") return {"inventory": available}
def GET_check_inventory(self, responder, sr, collection, location, start, end): if collection: target = Target(collection) sr = None else: sr = sr or Frontpage target = Target(sr.name) if not location or not location.country: available = inventory.get_available_pageviews( target, start, end, datestr=True) elif not collection and (sr == Frontpage or c.user_is_sponsor): # geotargeting is available on the Frontpage for all users or on # individual subreddits for sponsors available = inventory.get_available_pageviews_geotargeted(sr, location, start, end, datestr=True) else: return abort(403, 'forbidden') return {'inventory': available}
def GET_check_inventory(self, responder, sr, start, end): sr = sr or Frontpage available_by_datestr = inventory.get_available_pageviews(sr, start, end, datestr=True) return {'inventory': available_by_datestr}