def query(self, start_date=None, end_date=None, ndays=None, metrics=[], dimensions=[], filters=None, segment=None, sort=[], start_index=<NUM_LIT:1>, max_results=<NUM_LIT:10>):
if start_date:<EOL><INDENT>start_date = start_date<EOL><DEDENT>elif getattr(self.args, '<STR_LIT>'):<EOL><INDENT>start_date = getattr(self.args, '<STR_LIT>')<EOL><DEDENT>elif self.config.get('<STR_LIT>', None):<EOL><INDENT>start_date = self.config['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>start_date = '<STR_LIT>'<EOL><DEDENT>if end_date:<EOL><INDENT>end_date = end_date<EOL><DEDENT>elif getattr(self.args, '<STR_LIT>'):<EOL><INDENT>end_date = getattr(self.args, '<STR_LIT>')<EOL><DEDENT>elif self.config.get('<STR_LIT>', None):<EOL><INDENT>end_date = self.config['<STR_LIT>']<EOL><DEDENT>elif ndays:<EOL><INDENT>end_date = self._ndays(start_date, ndays)<EOL><DEDENT>elif self.args.ndays:<EOL><INDENT>end_date = self._ndays(start_date, self.args.ndays)<EOL><DEDENT>elif self.config.get('<STR_LIT>', None):<EOL><INDENT>end_date = self._ndays(start_date, self.config['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>end_date = '<STR_LIT>' <EOL><DEDENT>if self.args.domain:<EOL><INDENT>domain = self.args.domain<EOL><DEDENT>elif self.config.get('<STR_LIT>', None):<EOL><INDENT>domain = self.config['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>domain = None<EOL><DEDENT>if domain:<EOL><INDENT>domain_filter = '<STR_LIT>' % domain<EOL>if filters:<EOL><INDENT>filters = '<STR_LIT>' % (domain_filter, filters)<EOL><DEDENT>else:<EOL><INDENT>filters = domain_filter<EOL><DEDENT><DEDENT>if self.args.prefix:<EOL><INDENT>prefix = self.args.prefix<EOL><DEDENT>elif self.config.get('<STR_LIT>', None):<EOL><INDENT>prefix = self.config['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>prefix = None<EOL><DEDENT>if prefix:<EOL><INDENT>prefix_filter = '<STR_LIT>' % prefix <EOL>if filters:<EOL><INDENT>filters = '<STR_LIT>' % (prefix_filter, filters)<EOL><DEDENT>else:<EOL><INDENT>filters = prefix_filter<EOL><DEDENT><DEDENT>return self.service.data().ga().get(<EOL>ids='<STR_LIT>' + self.config['<STR_LIT>'],<EOL>start_date=start_date,<EOL>end_date=end_date,<EOL>metrics='<STR_LIT:U+002C>'.join(metrics) or None,<EOL>dimensions='<STR_LIT:U+002C>'.join(dimensions) or None,<EOL>filters=filters,<EOL>segment=segment,<EOL>sort='<STR_LIT:U+002C>'.join(sort) or None,<EOL>start_index=str(start_index),<EOL>max_results=str(max_results)<EOL>).execute()<EOL>
Execute a query.