Hi! I'm trying to use the AdSense Management API with Python 2.6.5 to retrieve earnings data. I make it past the oauth step fine, and I can get a report consisting of a single column just fine:
result = service.reports().generate(
startDate = "2011-01-01",
endDate = "2011-02-01",
filter = ("AD_CLIENT_ID==%s" % ad_client_id),
metric = "PAGE_VIEWS",
dimension = "DATE",
sort = "+DATE"
).execute()
This returns data that looks correct. However, if I try to pass in lists for any parameter, I get the Python error "TypeError: expected string or buffer". For example, this code returns that Python error:
result = service.reports().generate(
startDate = "2011-01-01",
endDate = "2011-02-01",
filter = ("AD_CLIENT_ID==%s" % ad_client_id),
metric = ["PAGE_VIEWS","EARNINGS"],
dimension = "DATE",
sort = "+DATE"
).execute()
Passing in lists is what the bottom of
http://code.google.com/apis/adsense/management/v1/complete_guide.html says to do, and it was only by fiddling around and trying things at random that I discovered it worked if you just pass in strings instead of lists. But I can't get multiple columns this way. I did try setting metric to "PAGE_VIEWS,EARNINGS" to see if a comma-delimited string would work, but then the response from the call to
www.googleapis.com comes back with "Invalid value 'PAGE_VIEWS,EARNINGS'. Values must match the following regular expression: '[a-zA-Z_]+'"
Any ideas? Thanks.