twitter API
twitter API
Before you’re able to collect tweets from the Twitter API, you need to create a developer
account. You can do this by following the steps on this website:
https://developer.twitter.com/en/docs/twitter-api/getting-started/getting-access-to-the-twitter api
Once you’ve done this, you need to create a new App within the Developer Portal
https://developer.twitter.com/en/portal/dashboard. As soon as you’ve done this, your app will
have a unique API_KEY, API_KEY_SECRET and BEARER_TOKEN, which you should insert
into the variables below.
Note: Do not share these tokens!
1
[8]: handle = "CommBank"
url = f"https://api.twitter.com/2/tweets/search/recent?query=from:
↪{handle}&tweet.fields=created_at&expansions=author_id&user.fields=created_at" headers =
{"Authorization": "Bearer {}".format(BEARER_TOKEN)}
[ ]:
[ ]:
[ ]: