def disable_pop()

in libs/google/gmail.py [0:0]


  def disable_pop(self, user_id):
    """
    Disables POP for the user.
    :param user_id:
    :return: bool
    Note: If accessWindow=disabled, then POP is disabled.
    """
    pop_setting = {
      'accessWindow': 'disabled'
    }

    try:
      r = json.loads(self.call_google_api(service=self.service,
                                          api_resource="users.settings",
                                          api_method="updatePop",
                                          response_field="accessWindow",
                                          userId=user_id,
                                          body=pop_setting))
      if r == "disabled":
        return True
      else:
        return False
    except(ValueError, KeyError, TypeError):
      return False