Twitter Api & tweepy & python dotenv - ftanrisevdi/swe573 GitHub Wiki

Twitter Api is a platform that you can reach your own Twitter Developer Account. This Api provides public tweets access. In this repository we use python and to connecting to Twitter Api, we use Tweepy.

Tweepy provides to easy access to the twitter api. Here is a simple code that I create to first access.

`import tweepy

auth = tweepy.OAuthHandler("xxxxxxx", "xxxxxxx") auth.set_access_token("xxxxxxx", "xxxxxxx")

api = tweepy.API(auth)

public_tweets = api.home_timeline() for tweet in public_tweets: print(tweet.text)`

I keep my credentials in .env files and I use python-dotenv.

Useful links: https://towardsdatascience.com/tweepy-for-beginners-24baf21f2c25