def query(self, **options):
if not self._query_path:<EOL><INDENT>raise AttributeError('<STR_LIT>' % self._item_name)<EOL><DEDENT>last_item = <NUM_LIT:0><EOL>offset = <NUM_LIT:0><EOL>current_item = None<EOL>limit = options.get('<STR_LIT>', <NUM_LIT>)<EOL>options['<STR_LIT>'] = limit<EOL>target = self._query_path<EOL>while True:<EOL><INDENT>options['<STR_LIT>'] = offset<EOL>json_data = self._redmine.get(target, options)<EOL>try:<EOL><INDENT>data = json.loads(json_data)<EOL><DEDENT>except:<EOL><INDENT>raise RedmineError(json_data)<EOL><DEDENT>data_container = data[self._query_container]<EOL>for item_data in data_container:<EOL><INDENT>yield(self._objectify(data=item_data))<EOL><DEDENT>if not data_container:<EOL><INDENT>break<EOL><DEDENT>try:<EOL><INDENT>if int(data['<STR_LIT>']) > ( offset + len(data_container) ):<EOL><INDENT>offset += limit<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>except:<EOL><INDENT>break<EOL><DEDENT><DEDENT>
Return an iterator for the given items.