# Gmail Postmaster Tools API . domains . trafficStats

## Instance Methods

Close httplib2 connections.

Get traffic statistics for a domain on a specific date. Returns PERMISSION_DENIED if user does not have permission to access TrafficStats for the domain.

List traffic statistics for all available days. Returns PERMISSION_DENIED if user does not have permission to access TrafficStats for the domain.

Retrieves the next page of results.

### Method Details

`close()`

    Close httplib2 connections.

`get(name, x__xgafv=None)`

    Get traffic statistics for a domain on a specific date. Returns PERMISSION_DENIED if user does not have permission to access TrafficStats for the domain.

    Args:
      name: string, The resource name of the traffic statistics to get. E.g., domains/mymail.mydomain.com/trafficStats/20160807. (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Email traffic statistics pertaining to a specific date.
      "deliveryErrors": [ # Delivery errors for the domain. This metric only pertains to traffic that passed [SPF](http://www.openspf.org/) or [DKIM](http://www.dkim.org/).
        { # Metric on a particular delivery error type.
          "errorClass": "A String", # The class of delivery error.
          "errorRatio": 3.14, # The ratio of messages where the error occurred vs all authenticated traffic.
          "errorType": "A String", # The type of delivery error.
        },
      ],
      "dkimSuccessRatio": 3.14, # The ratio of mail that successfully authenticated with DKIM vs. all mail that attempted to authenticate with [DKIM](http://www.dkim.org/). Spoofed mail is excluded.
      "dmarcSuccessRatio": 3.14, # The ratio of mail that passed [DMARC](https://dmarc.org/) alignment checks vs all mail received from the domain that successfully authenticated with either of [SPF](http://www.openspf.org/) or [DKIM](http://www.dkim.org/).
      "domainReputation": "A String", # Reputation of the domain.
      "inboundEncryptionRatio": 3.14, # The ratio of incoming mail (to Gmail), that passed secure transport (TLS) vs all mail received from that domain. This metric only pertains to traffic that passed [SPF](http://www.openspf.org/) or [DKIM](http://www.dkim.org/).
      "ipReputations": [ # Reputation information pertaining to the IP addresses of the email servers for the domain. There is exactly one entry for each reputation category except REPUTATION_CATEGORY_UNSPECIFIED.
        { # IP Reputation information for a set of IPs in a specific reputation category.
          "ipCount": "A String", # Total number of unique IPs in this reputation category. This metric only pertains to traffic that passed [SPF](http://www.openspf.org/) or [DKIM](http://www.dkim.org/).
          "numIps": "A String", # Total number of unique IPs in this reputation category. This metric only pertains to traffic that passed [SPF](http://www.openspf.org/) or [DKIM](http://www.dkim.org/). Deprecated to be complied with ApiLinter for Quantities. Use ip_count instead.
          "reputation": "A String", # The reputation category this IP reputation represents.
          "sampleIps": [ # A sample of IPs in this reputation category.
            "A String",
          ],
        },
      ],
      "name": "A String", # The resource name of the traffic statistics. Traffic statistic names have the form `domains/{domain}/trafficStats/{date}`, where domain_name is the fully qualified domain name (i.e., mymail.mydomain.com) of the domain this traffic statistics pertains to and date is the date in yyyymmdd format that these statistics corresponds to. For example: domains/mymail.mydomain.com/trafficStats/20160807
      "outboundEncryptionRatio": 3.14, # The ratio of outgoing mail (from Gmail) that was accepted over secure transport (TLS).
      "spammyFeedbackLoops": [ # Spammy [Feedback loop identifiers] (https://support.google.com/mail/answer/6254652) with their individual spam rates. This metric only pertains to traffic that is authenticated by [DKIM](http://www.dkim.org/).
        { # [Feedback loop](https://support.google.com/mail/answer/6254652) identifier information.
          "id": "A String", # Feedback loop identifier that uniquely identifies individual campaigns.
          "spamRatio": 3.14, # The ratio of user marked spam messages with the identifier vs the total number of inboxed messages with that identifier.
        },
      ],
      "spfSuccessRatio": 3.14, # The ratio of mail that successfully authenticated with SPF vs. all mail that attempted to authenticate with [SPF](http://www.openspf.org/). Spoofed mail is excluded.
      "userReportedSpamRatio": 3.14, # The ratio of user-report spam vs. email that was sent to the inbox. This metric only pertains to emails authenticated by [DKIM](http://www.dkim.org/).
    }

`list(parent, endDate_day=None, endDate_month=None, endDate_year=None, pageSize=None, pageToken=None, startDate_day=None, startDate_month=None, startDate_year=None, x__xgafv=None)`

    List traffic statistics for all available days. Returns PERMISSION_DENIED if user does not have permission to access TrafficStats for the domain.

    Args:
      parent: string, The resource name of the domain whose traffic statistics we'd like to list. It should have the form `domains/{domain_name}`, where domain_name is the fully qualified domain name. (required)
      endDate_day: integer, Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
      endDate_month: integer, Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
      endDate_year: integer, Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
      pageSize: integer, Requested page size. Server may return fewer TrafficStats than requested. If unspecified, server will pick an appropriate default.
      pageToken: string, The next_page_token value returned from a previous List request, if any. This is the value of ListTrafficStatsResponse.next_page_token returned from the previous call to `ListTrafficStats` method.
      startDate_day: integer, Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
      startDate_month: integer, Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
      startDate_year: integer, Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Response message for ListTrafficStats.
      "nextPageToken": "A String", # Token to retrieve the next page of results, or empty if there are no more results in the list.
      "trafficStats": [ # The list of TrafficStats.
        { # Email traffic statistics pertaining to a specific date.
          "deliveryErrors": [ # Delivery errors for the domain. This metric only pertains to traffic that passed [SPF](http://www.openspf.org/) or [DKIM](http://www.dkim.org/).
            { # Metric on a particular delivery error type.
              "errorClass": "A String", # The class of delivery error.
              "errorRatio": 3.14, # The ratio of messages where the error occurred vs all authenticated traffic.
              "errorType": "A String", # The type of delivery error.
            },
          ],
          "dkimSuccessRatio": 3.14, # The ratio of mail that successfully authenticated with DKIM vs. all mail that attempted to authenticate with [DKIM](http://www.dkim.org/). Spoofed mail is excluded.
          "dmarcSuccessRatio": 3.14, # The ratio of mail that passed [DMARC](https://dmarc.org/) alignment checks vs all mail received from the domain that successfully authenticated with either of [SPF](http://www.openspf.org/) or [DKIM](http://www.dkim.org/).
          "domainReputation": "A String", # Reputation of the domain.
          "inboundEncryptionRatio": 3.14, # The ratio of incoming mail (to Gmail), that passed secure transport (TLS) vs all mail received from that domain. This metric only pertains to traffic that passed [SPF](http://www.openspf.org/) or [DKIM](http://www.dkim.org/).
          "ipReputations": [ # Reputation information pertaining to the IP addresses of the email servers for the domain. There is exactly one entry for each reputation category except REPUTATION_CATEGORY_UNSPECIFIED.
            { # IP Reputation information for a set of IPs in a specific reputation category.
              "ipCount": "A String", # Total number of unique IPs in this reputation category. This metric only pertains to traffic that passed [SPF](http://www.openspf.org/) or [DKIM](http://www.dkim.org/).
              "numIps": "A String", # Total number of unique IPs in this reputation category. This metric only pertains to traffic that passed [SPF](http://www.openspf.org/) or [DKIM](http://www.dkim.org/). Deprecated to be complied with ApiLinter for Quantities. Use ip_count instead.
              "reputation": "A String", # The reputation category this IP reputation represents.
              "sampleIps": [ # A sample of IPs in this reputation category.
                "A String",
              ],
            },
          ],
          "name": "A String", # The resource name of the traffic statistics. Traffic statistic names have the form `domains/{domain}/trafficStats/{date}`, where domain_name is the fully qualified domain name (i.e., mymail.mydomain.com) of the domain this traffic statistics pertains to and date is the date in yyyymmdd format that these statistics corresponds to. For example: domains/mymail.mydomain.com/trafficStats/20160807
          "outboundEncryptionRatio": 3.14, # The ratio of outgoing mail (from Gmail) that was accepted over secure transport (TLS).
          "spammyFeedbackLoops": [ # Spammy [Feedback loop identifiers] (https://support.google.com/mail/answer/6254652) with their individual spam rates. This metric only pertains to traffic that is authenticated by [DKIM](http://www.dkim.org/).
            { # [Feedback loop](https://support.google.com/mail/answer/6254652) identifier information.
              "id": "A String", # Feedback loop identifier that uniquely identifies individual campaigns.
              "spamRatio": 3.14, # The ratio of user marked spam messages with the identifier vs the total number of inboxed messages with that identifier.
            },
          ],
          "spfSuccessRatio": 3.14, # The ratio of mail that successfully authenticated with SPF vs. all mail that attempted to authenticate with [SPF](http://www.openspf.org/). Spoofed mail is excluded.
          "userReportedSpamRatio": 3.14, # The ratio of user-report spam vs. email that was sent to the inbox. This metric only pertains to emails authenticated by [DKIM](http://www.dkim.org/).
        },
      ],
    }

`list_next(previous_request, previous_response)`

    Retrieves the next page of results.

    Args:
      previous_request: The request for the previous page. (required)
      previous_response: The response from the request for the previous page. (required)

    Returns:
      A request object that you can call 'execute()' on to request the next
      page. Returns None if there are no more items in the collection.