Fixes Issue 297 "Unresolved reference" in AdSense Management API samples
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
"""This example retrieves a report for the specified ad client.
|
"""Retrieves a saved report or a report for the specified ad client.
|
||||||
|
|
||||||
To get ad clients, run get_all_ad_clients.py.
|
To get ad clients, run get_all_ad_clients.py.
|
||||||
|
|
||||||
@@ -31,9 +31,11 @@ from oauth2client import client
|
|||||||
|
|
||||||
# Declare command-line flags.
|
# Declare command-line flags.
|
||||||
argparser = argparse.ArgumentParser(add_help=False)
|
argparser = argparse.ArgumentParser(add_help=False)
|
||||||
argparser.add_argument('ad_client_id',
|
argparser.add_argument(
|
||||||
|
'--ad_client_id',
|
||||||
help='The ID of the ad client for which to generate a report')
|
help='The ID of the ad client for which to generate a report')
|
||||||
argparser.add_argument('report_id',
|
argparser.add_argument(
|
||||||
|
'--report_id',
|
||||||
help='The ID of the saved report to generate')
|
help='The ID of the saved report to generate')
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +53,7 @@ def main(argv):
|
|||||||
# Retrieve report.
|
# Retrieve report.
|
||||||
if saved_report_id:
|
if saved_report_id:
|
||||||
result = service.reports().saved().generate(
|
result = service.reports().saved().generate(
|
||||||
savedReportId=saved_report_id).execute()
|
savedReportId=saved_report_id).execute()
|
||||||
elif ad_client_id:
|
elif ad_client_id:
|
||||||
result = service.reports().generate(
|
result = service.reports().generate(
|
||||||
startDate='2011-01-01', endDate='2011-08-31',
|
startDate='2011-01-01', endDate='2011-08-31',
|
||||||
@@ -62,8 +64,7 @@ def main(argv):
|
|||||||
dimension=['DATE'],
|
dimension=['DATE'],
|
||||||
sort=['+DATE']).execute()
|
sort=['+DATE']).execute()
|
||||||
else:
|
else:
|
||||||
print ('Specify ad client id or saved report id!\nUsage: %s ARGS\\n%s'
|
argparser.print_help()
|
||||||
% (sys.argv[0], gflags.FLAGS))
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
# Display headers.
|
# Display headers.
|
||||||
for header in result['headers']:
|
for header in result['headers']:
|
||||||
|
|||||||
@@ -30,16 +30,16 @@ import sys
|
|||||||
from apiclient import sample_tools
|
from apiclient import sample_tools
|
||||||
from oauth2client import client
|
from oauth2client import client
|
||||||
|
|
||||||
import sys
|
|
||||||
import gflags
|
|
||||||
|
|
||||||
# Declare command-line flags.
|
# Declare command-line flags.
|
||||||
argparser = argparse.ArgumentParser(add_help=False)
|
argparser = argparse.ArgumentParser(add_help=False)
|
||||||
argparser.add_argument('account_id',
|
argparser.add_argument(
|
||||||
|
'account_id',
|
||||||
help='The ID of the account with the specified ad unit')
|
help='The ID of the account with the specified ad unit')
|
||||||
argparser.add_argument('ad_client_id',
|
argparser.add_argument(
|
||||||
|
'ad_client_id',
|
||||||
help='The ID of the ad client with the specified ad unit')
|
help='The ID of the ad client with the specified ad unit')
|
||||||
argparser.add_argument('ad_unit_id',
|
argparser.add_argument(
|
||||||
|
'ad_unit_id',
|
||||||
help='The ID of the ad unit for which to get custom channels')
|
help='The ID of the ad unit for which to get custom channels')
|
||||||
|
|
||||||
MAX_PAGE_SIZE = 50
|
MAX_PAGE_SIZE = 50
|
||||||
|
|||||||
Reference in New Issue
Block a user