Ejemplo n.º 1
0
 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}
Ejemplo n.º 2
0
 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}
Ejemplo n.º 3
0
 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}
Ejemplo n.º 4
0
 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}
Ejemplo n.º 5
0
    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}
Ejemplo n.º 6
0
    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}