I am trying to receive full text of the tweet, but receive only ...
in the end,
Full tweet text: This is the full text of the tweet
I receive: This is full ...
This is my code:
import asyncio
import logging
from tweepy.asynchronous import AsyncClient
from app.common.config import settings
from app.common.database import get_async_db
from app.db.models.models import InsightModel, TwitterAccountModel
from app.db.repositories.insight_repository import create_insights
from app.services.collectors.base_collector import BaseCollector
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
class TwitterCollector(BaseCollector):
def __init__(self, twitter_account_model: TwitterAccountModel):
super().__init__()
self.twitter_account_model = twitter_account_model
self.client = AsyncClient(
bearer_token=settings.TWITTER_API_BEARER,
consumer_key=settings.TWITTER_API_KEY,
consumer_secret=settings.TWITTER_API_SECRET,
access_token=settings.TWITTER_API_ACCESS_TOKEN,
access_token_secret=settings.TWITTER_API_ACCESS_TOKEN_SECRET,
)
async def run(self):
tweets = await self.client.get_users_tweets(
id=self.twitter_account_model.account_id,
max_results=5,
tweet_fields=["text","created_at"],
exclude=["retweets", "replies"],
)
logger.info(f"Pulled {len(tweets)} tweets, tweets: {tweets}")
insights = map(
lambda tweet: InsightModel(
text=str(tweet.text),
external_id=str(tweet.id),
payload={
"created_at": str(tweet.created_at),
},
insight_tags=self.twitter_account_model.insight_tags,
),
tweets.data,
)
async with get_async_db() as session:
await create_insights(session=session, insights=insights)
I tried to research Twitter API but didn't get the answer, this isn't helping me: Issue with Twitter API v2