Ingests tweets using Twitter's RecentAPI.
Project description
av-tweet-ingestion
Ingestion of tweets using Twitter's RecentAPI and upload to S3.
Installation
pip install av-tweet-ingestion
Usage example - Twitter Recent API
Setup Environmental Variables
BEARER_TOKEN="<twitter_bearer_token>"
S3_ACESS_KEY="<acess_key>"
S3_SECRET_KEY="<secret_key>"
S3_BUCKET_NAME="<bucket_name>"
S3_LANDING_LAYER="<landing_zone>"
Define Query
Build query to request tweets.
https://developer.twitter.com/en/docs/twitter-api/tweets/search/integrate/build-a-query
query_params = {
'query': 'from: elonmusk',
'user.fields':'id,location,name,public_metrics,created_at',
'tweet.fields': 'author_id',
# 'expansions':'geo.place_id,author_id,entities.mentions.username,in_reply_to_user_id,referenced_tweets.id.author_id',
'max_results':'10'
}
Ingest
Imports
from ingestion.apis import RecentAPI
from ingestion.ingestors import BatchIngestor
from ingestion.writers import S3Writer
BatchIngestor(query_params, # Query
1, # Number of pages to ingest
RecentAPI, # Titter's API to call
'test/RecentAPI', # Set address to save data
S3Writer).ingest() # Writer to be used
Contributing
-
Fork it (https://github.com/andreveit/av-tweet-ingestion/fork)
-
Create your feature branch (
git checkout -b feature/fooBar
) -
Commit your changes (
git commit -am 'Add some fooBar'
) -
Push to the branch (
git push origin feature/fooBar
) -
Create a new Pull Request
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file av-tweet-ingestion-1.0.5.tar.gz
.
File metadata
- Download URL: av-tweet-ingestion-1.0.5.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8870f210ec2a63009be59ab8fe15777f99dd2e474e345ca519b66c9e988caad1 |
|
MD5 | 94f1841aaacf1ab375401de2d8271b5d |
|
BLAKE2b-256 | f27e7d6e86059fa2fe573c03cc8d1f7c2621f2871b68960484648c38b90b5f37 |
File details
Details for the file av_tweet_ingestion-1.0.5-py3-none-any.whl
.
File metadata
- Download URL: av_tweet_ingestion-1.0.5-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2758a47004f42b5aa300112836af51c215dfe5fed2d622a170db8a441127ca02 |
|
MD5 | 69faf78c13a08d08a00ba4183a53c8d3 |
|
BLAKE2b-256 | 0365d701c1d710fe8a5328c5008ad749029ff59a0e1f0964c5822c067349cff4 |