INNER CODE UNIT · Python

schedule_tweet

trevorhobenshield/twitter-api-client · twitter/account.py:171

    def schedule_tweet(self, text: str, date: int | str, *, media: list = None) -> dict:
        variables = {
            'post_tweet_request': {
                'auto_populate_reply_metadata': False,
                'status': text,
                'exclude_reply_user_ids': [],
                'media_ids': [],
            },
            'execute_at': (
                datetime.strptime(date, "%Y-%m-%d %H:%M").timestamp()
                if isinstance(date, str)
                else date
            ),
        }
        if media:
            for m in media:
                media_id = self._upload_media(m['media'])
                variables['post_tweet_request']['media_ids'].append(media_id)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…