def __init__(
            self,
            *,
            record_data: Dict[str, Any]={},
            error: tweepy.TweepError=None,
    ) -> None:
        """
        Create tweet record object.

        :param record_data: data to use to generate a TweetRecord.
        :param error: error encountered while posting,
            to generate a record with.
        """
        super().__init__()
        self._type = self.__class__.__name__
        self.tweet_id = record_data.get("tweet_id", None)
        self.id = self.tweet_id
        self.text = record_data.get("text", None)
        self.files = record_data.get("files", [])
        self.media_ids = record_data.get("media_ids", [])
        self.captions = record_data.get("captions", [])
        self.timestamp = record_data.get("timestamp", None)
        self.in_reply_to = record_data.get("in_reply_to", None)
        self.in_reply_to_id = record_data.get("in_reply_to_id", None)

        if error is not None:
            # So Python doesn't get upset when we try to json-dump the record later.
            try:
                self.error = json.dumps(error.__dict__)
            except TypeError:
                # fuck you
                self.error = str(error)

            try:
                if isinstance(error.message, str):
                    self.error_message = error.message
                elif isinstance(error.message, list):
                    self.error_code = error.message[0]["code"]
                    self.error_message = error.message[0]["message"]
            except AttributeError:
                # fine, I didn't want it anyways.
                pass
def __init__ ( self , * , record_data : Dict [ str , Any ] = { } , error : tweepy . TweepError = None , ) -> None : super ( ) . __init__ ( ) self . _type = self . __class__ . __name__ self . tweet_id = record_data . get ( "tweet_id" , None ) self . id = self . tweet_id self . text = record_data . get ( "text" , None ) self . files = record_data . get ( "files" , [ ] ) self . media_ids = record_data . get ( "media_ids" , [ ] ) self . captions = record_data . get ( "captions" , [ ] ) self . timestamp = record_data . get ( "timestamp" , None ) self . in_reply_to = record_data . get ( "in_reply_to" , None ) self . in_reply_to_id = record_data . get ( "in_reply_to_id" , None ) if error is not None : try : self . error = json . dumps ( error . __dict__ ) except TypeError : self . error = str ( error ) try : if isinstance ( error . message , str ) : self . error_message = error . message elif isinstance ( error . message , list ) : self . error_code = error . message [ 0 ] [ "code" ] self . error_message = error . message [ 0 ] [ "message" ] except AttributeError : pass
Create tweet record object.

        :param record_data: data to use to generate a TweetRecord.
        :param error: error encountered while posting,
            to generate a record with.