'Authenticating other Users from my App - Tweepy
I've created an app in python to like tweets by hitting the POST endpoint -very simple.
Next I'd like to have an account different than mine able to login and authenticate to use the feature.
I have no clue how to do that and would appreciate any advice I'm a junior dev, just starting to mess around with an API
for background: I'm going to implement this in flask but for now, just have a python like.py file with basic logic in it for my dev account authentication
import tweepy
import config
import time
client = tweepy.Client(
bearer_token=config.bearer_token,
consumer_key=config.consumer_key,
consumer_secret=config.consumer_secret,
access_token=config.access_token,
access_token_secret=config.access_token_secret
)
print('Sup Loser, what you wanna like? \n')
search = input('query: ')
query= f'{search} -is:retweet -has:media -is:reply'
response = client.search_recent_tweets(query=query, max_results=42)
for tweets in response.data:
id = tweets.id
print(f"searching '{search}' liking tweet -- ID# {id} -- URL https://twitter.com/twitter/statuses/{id}")
time.sleep(1)
client.like(id)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
