We don't have a standard sample set, but this is something I've done a few times. I recommend you check out the
Python client library's documentation and read up on how to generate, store, and retrieve OAuth 2.0 credentials. I usually do it like this:
def main():
profile_id = 1234567 # Enter DFA profile ID here
report_id = 2345678 # Enter report ID here
file_id = 3456789 # Enter file ID here
credentials = ... # Get OAuth 2.0 credentials, probably from the client library's Storage.
http = httplib2.Http()
http = credentials.authorize(http)
service = build('dfareporting', 'v1.3', http=http)
download_report(service, profile_id, report_id, file_id, http)
def download_report(service, profile_id, report_id, file_id, http):
report_file = service.reports().files().get(profileId=profile_id, reportId=report_id, fileId=file_id).execute()
download_url = report_file['urls']['apiUrl']
response, content = http.request(download_url)
if response['status'] == '200':
print content