Unofficial tool to download and flatten data from GPT (Google Postmaster Tools API v2). The recovered data will offer a simple schema in order to be able to easily save this data in a flat file or in database
- user_report_spam_percent :
float|None - domain_compliance :
dict|None - feedback_loop :
{ nb_row: 0, percent_per_uid: list } - auth_use_dkim_percent :
float|None - auth_use_spf_percent :
float|None - auth_use_dmarc_percent :
float|None - tls_inbound_percent :
float|None - delivery_errors :
list - domain :
str - date :
str
Compliance status of the domain, as returned by GPT's getComplianceStatus. Unlike the old domain_reputation int level, this is not a score and is not tied to a specific date : it reflects the domain's compliance state at the time of the call
percent_per_uid : [ { 'uid': int, 'spam_percent': float } ]
[ { 'class': str, 'type': str, 'percent': float } ]
Google retired the v1/v1beta1 Postmaster Tools API in favor of a metric-query based v2 API (domains().domainStats().query(...) and domains().getComplianceStatus(...) instead of a single domains().trafficStats().get(...) call per domain/date). This changes the schema returned by this library :
domain_reputation(int level 0-4) andips_reputations(per-ip reputation breakdown) no longer have any equivalent in v2 : Google removed the reputation bars entirely.domain_reputationis replaced bydomain_compliance, sourced from the newgetComplianceStatusendpoint.ips_reputationshas no replacement at all in v2 (no per-ip data is exposed anywhere in the API) and is kept in the schema, always empty, for backward compatibility onlyfeedback_loopnow requires two sequential GPT calls per domain/date (discover the feedback loop ids used that day, then query the spam rate of each id) instead of onedelivery_errorsis reconstructed from up to 10 filteredDELIVERY_ERROR_RATEmetrics (one per knownerror_type/error_reasoncombination) requested in a singlequery()call, to keep the same class/type granularity as beforeuser_report_spam_percent,auth_use_*_percentandtls_inbound_percentare sourced from the newSPAM_RATE,AUTH_SUCCESS_RATEandTLS_ENCRYPTION_RATEmetrics ; they are assumed to be 0-1 ratios like their v1 counterparts, but this has not been validated against real GPT data- Requires
google-api-python-client>= 2.196.0 (bundles the v2 discovery document).
python entry_points_googlepostmasterapi/gpt_dl_all_data.py -h
> usage: gpt_dl_all_data [-h] [--token [TOKEN]] [--pool-size [POOL_SIZE]] [--date [DATE]] [--verbose] [--version]python entry_points_googlepostmasterapi/gpt_dl_domain_data.py -h
> usage: gpt_dl_domain_data [-h] [--token [TOKEN]] [--domain [DOMAIN]] [--date [DATE]] [--verbose] [--version]python entry_points_googlepostmasterapi/gpt_dl_domains.py
> usage: gpt_dl_domains [-h] [--token [TOKEN]] [--verbose] [--version]Python : >=3.9
{ 'deliverability': { 'status': 'compliant'|'needs_work'|null, 'reason': str|null }, 'one_click_unsubscribe': { 'status': 'compliant'|'needs_work'|null, 'reason': str|null }, 'honor_unsubscribe': { 'status': 'compliant'|'needs_work'|null, 'reason': str|null }, 'checks': [ { 'check': str, 'status': 'compliant'|'needs_work'|null }, { 'check': str, 'status': 'compliant'|'needs_work'|null }, { 'check': str, 'status': 'compliant'|'needs_work'|null }, ... ] }