#NEWLINE# def work( self , stream_id ) : #NEWLINE# #INDENT# result = [ ] #NEWLINE# continuation_token = None #NEWLINE# next_progress_report = FetchItemRefsWorker . _PROGRESS_REPORT_INTERVAL #NEWLINE# while True : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( item_refs , continuation_token ) = self . _api . fetch_item_refs ( stream_id , count = self . _chunk_size , continuation_token = continuation_token ) #NEWLINE# #UNINDENT# except urllib2 . HTTPError as e : #NEWLINE# #INDENT# if ( ( e . code == 400 ) and ( 'Permission denied' in e . read ( ) ) ) : #NEWLINE# #INDENT# logging . warn ( "  Permission denied when getting items for the stream %s, it's most likely private now." , stream_id ) #NEWLINE# return None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# result . extend ( item_refs ) #NEWLINE# if ( len ( result ) >= next_progress_report ) : #NEWLINE# #INDENT# logging . debug ( '  %s item refs fetched so far from %s' , '{:,}' . format ( len ( result ) ) , stream_id ) #NEWLINE# next_progress_report += FetchItemRefsWorker . _PROGRESS_REPORT_INTERVAL #NEWLINE# #UNINDENT# if ( ( not continuation_token ) or ( e . _max_items_per_stream and ( len ( result ) >= self . _max_items_per_stream ) ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# return result