(self, strip=None)
return json.dumps(prep)
Utility function that creates a JSON representation of a Credentials
        object.

        Args:
            strip (Sequence[str]): Optional list of members to exclude from the
                                   generated JSON.

        Returns:
            str: A JSON representation of this instance. When converted into
            a dictionary, it can be passed to from_authorized_user_info()
            to create a new credential instance.
Utility function that creates a JSON representation of a Credentials
        object.
Utility function that creates a JSON representation of a Credentials object .
def to_json(self, strip=None):
        """Utility function that creates a JSON representation of a Credentials
        object.

        Args:
            strip (Sequence[str]): Optional list of members to exclude from the
                                   generated JSON.

        Returns:
            str: A JSON representation of this instance. When converted into
            a dictionary, it can be passed to from_authorized_user_info()
            to create a new credential instance.
        """
        prep = {
            "token": self.token,
            "refresh_token": self.refresh_token,
            "token_uri": self.token_uri,
            "client_id": self.client_id,
            "client_secret": self.client_secret,
            "scopes": self.scopes,
            "rapt_token": self.rapt_token,
        }
        if self.expiry:  # flatten expiry timestamp
            prep["expiry"] = self.expiry.isoformat() + "Z"

        # Remove empty entries (those which are None)
        prep = {k: v for k, v in prep.items() if v is not None}

        # Remove entries that explicitely need to be removed
        if strip is not None:
            prep = {k: v for k, v in prep.items() if k not in strip}

        return json.dumps(prep)
def to_json ( self , strip = None ) : prep = { "token" : self . token , "refresh_token" : self . refresh_token , "token_uri" : self . token_uri , "client_id" : self . client_id , "client_secret" : self . client_secret , "scopes" : self . scopes , "rapt_token" : self . rapt_token , } if self . expiry : # flatten expiry timestamp prep [ "expiry" ] = self . expiry . isoformat ( ) + "Z" # Remove empty entries (those which are None) prep = { k : v for k , v in prep . items ( ) if v is not None } # Remove entries that explicitely need to be removed if strip is not None : prep = { k : v for k , v in prep . items ( ) if k not in strip } return json . dumps ( prep )