class_docstr: A class for handling connections and interactions with the Gmail API.
  
  Attributes:
      credentials_file (str): The path to the Google Auth Credentials file for authentication
      and interacting with the Gmail API on behalf of the uesr.
  
      scopes (List[str], Optional): The scopes to use when authenticating with the Gmail API.
class_docstr_tok: ["A","class","for","handling","connections","and","interactions","with","the","Gmail","API",".","Attributes",":","credentials_file","(","str",")",":","The","path","to","the","Google","Auth","Credentials","file","for","authentication","and","interacting","with","the","Gmail","API","on","behalf","of","the","uesr",".","scopes","(","List","[","str","]",",","Optional",")",":","The","scopes","to","use","when","authenticating","with","the","Gmail","API","."]
code: def __init__(self, name=None, **kwargs):
      super().__init__(name)
      self.connection_args = kwargs.get("connection_data", {})
  
      self.credentials_url = self.connection_args.get(
          "credentials_url", None
      )
      self.credentials_file = self.connection_args.get(
          "credentials_file", None
      )
      if self.connection_args.get("credentials"):
          self.credentials_file = self.connection_args.pop(
              "credentials"
          )
      if not self.credentials_file and not self.credentials_url:
          # try to get from config
          gm_config = Config().get("handlers", {}).get("gmail", {})
          secret_file = gm_config.get("credentials_file")
          secret_url = gm_config.get("credentials_url")
          if secret_file:
              self.credentials_file = secret_file
          elif secret_url:
              self.credentials_url = secret_url
  
      self.scopes = self.connection_args.get("scopes", DEFAULT_SCOPES)
      self.token_file = None
      self.max_page_size = 500
      self.max_batch_size = 100
      self.service = None
      self.is_connected = False
  
      self.handler_storage = kwargs["handler_storage"]
  
      emails = EmailsTable(self)
      self.emails = emails
      self._register_table("emails", emails)
  
imports: import json
  from shutil import copyfile
  from collections import OrderedDict
  import requests
  from mindsdb.integrations.libs.response import HandlerStatusResponse, HandlerResponse
  from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE
  from mindsdb.integrations.utilities.sql_utils import extract_comparison_conditions
  from mindsdb.integrations.libs.api_handler import APIHandler, APITable
  from mindsdb_sql.parser import ast
  from mindsdb.utilities import log
  from mindsdb_sql import parse_sql
  from mindsdb.utilities.config import Config
  import os
  import time
  from typing import List
  import pandas
  from google.auth.transport.requests import Request
  from google.oauth2.credentials import Credentials
  from google_auth_oauthlib.flow import Flow
  from googleapiclient.discovery import build
  from googleapiclient.errors import HttpError
  from email.message import EmailMessage
  from base64 import urlsafe_b64encode, urlsafe_b64decode
  from .utils import AuthException, google_auth_flow, save_creds_to_file
label_desc: Use image node_id 1 to create a new GmailHandler object from inherited base classes: APIHandler with example: obj = GmailHandler(name)