@@ -138,9 +138,10 @@ def report(self, scope=None, groups=None, metrics=None, where=None, from_=None,
138138 See the `reporting atomx wiki <https://wiki.atomx.com/reporting>`_
139139 for details about parameters and available groups, metrics.
140140
141- :param str scope: either 'advertiser', 'publisher' or 'network' to select the type
142- of report. If undefined it tries to determine the `scope` automatically based
143- on the `groups` and `metrics` parameters and the access rights of the api user.
141+ :param str scope: Specifies the report type. Should be one of:
142+ 'advertiser', 'publisher', 'network_managed', 'network_buy', 'network_sell'.
143+ If undefined it tries to determine the `scope` automatically based
144+ on the access rights of the api user.
144145 :param list groups: columns to group by.
145146 :param list metrics: columns to sum on.
146147 :param list where: is a list of expression lists.
@@ -182,22 +183,17 @@ def report(self, scope=None, groups=None, metrics=None, where=None, from_=None,
182183 raise MissingArgumentError ('Either `groups` or `metrics` have to be set.' )
183184
184185 if scope is None :
185- for i in report_json .get ('groups' , []) + report_json .get ('metrics' , []):
186- if '_network' in i :
187- scope = 'network'
188- break
189- else :
190- user = self .user
191- if len (user .networks ) > 0 :
192- pass # user has network access so could be any report (leave scope as None)
193- elif len (user .publishers ) > 0 and len (user .advertisers ) == 0 :
194- scope = 'publishers'
195- elif len (user .advertisers ) > 0 and len (user .publishers ) == 0 :
196- scope = 'advertisers'
197-
198- if scope is None :
199- raise MissingArgumentError ('Unable to detect scope automatically. '
200- 'Please set `scope` parameter.' )
186+ user = self .user
187+ if len (user .networks ) > 0 :
188+ pass # user has network access so could be any report (leave scope as None)
189+ elif len (user .publishers ) > 0 and len (user .advertisers ) == 0 :
190+ scope = 'publishers'
191+ elif len (user .advertisers ) > 0 and len (user .publishers ) == 0 :
192+ scope = 'advertisers'
193+
194+ if scope is None :
195+ raise MissingArgumentError ('Unable to detect scope automatically. '
196+ 'Please set `scope` parameter.' )
201197 report_json ['scope' ] = scope
202198
203199 if where :
0 commit comments