def get_batch(self, org, limit=200, page=1, since=None):
        params = dict(limit=limit, offset=(page-1)*limit )
        
        # This is being urlencoded in python-facebook-sdk
        # so don't include the param if it's None
        if since:
            params['since'] = since
            
        try:
            posts = self.api.get_connections(str(org.facebook_id), 'posts', fields='message,link,name,caption,description,type', **params)    
        except Exception:
            return [], None, None
    
        # Can use this but doesn't really account for not fetching data twice
        paging = posts.get('paging', {})
        
        next_page = None
        
        if len(posts.get('data', [])) == limit:
            next_page = page + 1
        
        new_last_fetched_date = None
    
        if page==1:
            parsed_query_string = urlparse.parse_qs(urlparse.urlparse(paging.get('previous', '')).query)
            new_last_fetched_date = parsed_query_string.get('since', [None])[0]
    
        return posts['data'], next_page, new_last_fetched_date
dataset/ETHPy150Open jumoconnect/openjumo/jumodjango/miner/jobs/fetch_facebook.py/FacebookMapper.get_batch/original