Questions tagged [twitterapi-python]

For questions specific to usage of the Twitter API whereby Python is the primary language being utilized. When using this tag also include the more generic [twitter] and [python] tags. Please also tag the third party library you are using for context.

TwitterAPI is a Python 2.x and 3.x library for accessing Twitter's official API. See the github repository

See also:

348 questions
10
votes
2 answers

Twitter API.get_user() TypeError: takes 1 positional argument but 2 were given ​

I'm still really new to coding and currently taking courses online, in which we are beginning to work with the Twitter API. I am trying to capture the ID of a Twitter account and display it below, but I keep getting this TypeError and can't figure…
chrisscartier
  • 101
  • 1
  • 1
  • 5
9
votes
4 answers

Python os.getenv() returning None when set Windows environment variables

I am following a Twitter bot tutorial using the Twippy library and Twitter API: https://realpython.com/twitter-bot-python-tweepy/ I set the config.py file and set my Windows environment variables as user variables with all my tokens. But when I run…
5
votes
2 answers

How to use tweepy for Twitter API v2 in getting user id by username?

I'm trying to replicate this snippet from geeksforgeeks, except that it uses the oauth for Twitter API v1.1 while I the API v2. # the screen name of the user screen_name = "PracticeGfG" # fetching the user user = api.get_user(screen_name) #…
Dwight
  • 53
  • 1
  • 3
5
votes
2 answers

Twitter API v2: response failing when params has start_time, end_time

Been playing with the Twitter API. Things were going well until I added start and end times, and granularity to my searches. I'm fairly confident the string values are correct, as per Twitter api docs, and added correctly to params. However I'm…
DaftVader
  • 105
  • 1
  • 11
5
votes
3 answers

Twitter no longer works with requests library python

I have a python function that uses the requests library and BeautifulSoup to scrape a particular user's tweets. import requests from bs4 import BeautifulSoup contents = requests.get("https://twitter.com/user") soup = BeautifulSoup(contents.text,…
J.t.p
  • 51
  • 1
  • 3
4
votes
1 answer

How to get source video URL from user tweet timeline using twitter API V2

I am using following url for fetching users tweets. https://api.twitter.com/2/users/{user_twitter_id}/tweets Following are my Request parameters query_params = { 'max_results': max_results, 'expansions': 'attachments.media_keys', …
Huwaiza
  • 77
  • 2
  • 13
4
votes
2 answers

How do I embed emoji into Tweepy status text?

I have the following code that allows me type a text on the console that then is sent as a comment to tweets. How can I embed emojis into this? For example the emoji code for a smile is "U+1F600". When I add this as an entry as follows on the…
ibexy
  • 609
  • 3
  • 16
  • 34
4
votes
2 answers

How do you use TwitterPager in TwitterAPI in Python to make multiple calls?

I'm trying to do a search for tweets in Twitter's premium API. I copied the format in the TwitterAPI documentation into my current code, but I get the following error. What am I missing? I am fairly new to Python. I'm using Twitter's sandbox premium…
mochiroar
  • 41
  • 4
3
votes
1 answer

Problem using tweepy the error 403 Forbidden apeared without making any changes

Hello there thanks for reading my post. I was using this same code yesterday and it was okay but today stoped working and i got this error: raise Forbidden(response) tweepy.errors.Forbidden: 403 Forbidden When authenticating requests to the Twitter…
3
votes
2 answers

Twitter API v2 - Free Version - Getting Follower Numbers - 2023

Does anyone know if it is still possible to collect the number of followers for a given Twitter account using the free version of the Twitter v2 API (after Feb 9th, 2023)? I tried getting access to the API using the following code, but got the…
Othoninho
  • 51
  • 3
3
votes
1 answer

How can I find mentions of my account and reply to tweets that mention me using tweepy and twitter API v2?

There seems to be little to no support so far for the newer versions of Tweepy and the new Twitter API and I would like to reply to tweets based on mention of my account but I'm not sure how to retrieve a tweet id that mentions me so I can reply to…
3
votes
4 answers

Twitter API V2 403: Forbidden using tweepy

I'm not able to authenticate using my twitter developer account even though my account active import tweepy consumer_key= 'XX1' consumer_secret= 'XX2' access_token= 'XX3' access_token_secret= 'XX4' auth = tweepy.OAuthHandler(consumer_key,…
Bani
  • 101
  • 1
  • 1
  • 8
3
votes
1 answer

Tweepy not returning the given amount of tweets

I have the following code api = tweepy.API(auth,wait_on_rate_limit=True) for tweet in tweepy.Cursor(api.search, tweet_mode="extended", q=query + " exclude:retweets").items(11000): hashtags…
Eagle
  • 318
  • 4
  • 16
3
votes
0 answers

Twitter streaming API not getting all retweets

I'm using the streaming API to follow a specific user id, and I'm able to stream without any issues. However, when I compare all streamed tweets collected in one day to the ones collected with the rest API it seems that the stream API missed some…
2
votes
1 answer

Getting Forbidding error while trying to tweak a sentiment analyses bot

So i was finding older versions of sentiment bots i could tweak and reuse and found this one from 9m ago but its giving me forbiddion error when i try to connect to twiiter api(error is below) Forbidden: 403 Forbidden 453 - You currently have access…
Yoshi
  • 21
  • 1
1
2 3
23 24