Minimal utilities to query TwitterAPI.io for followings and tweets, plus notebook helpers.
Using uv (recommended):
cd xapi-ex1
uv venv
source .venv/Scripts/activate
uv syncOr pip:
cd xapi-ex1
python -m venv .venv
source .venv/Scripts/activate
python -m pip install -U pip
pip install -r <(uv pip compile pyproject.toml || echo "python-dotenv requests pandas")Installing new packages
# from root dir
uv add statsmodelsCreate a .env with:
twitterapiio_key=YOUR_API_KEYfrom users import get_user_tweets
import os
api_key = os.getenv("twitterapiio_key")
resp = get_user_tweets(api_key=api_key, username="nelvOfficial", limit=20, include_replies=True)
tweets = resp["tweets"]
print(len(tweets))- Activate kernel for
.venv, opennotebooks/nb.ipynb, run cells. - CSVs save to
data/csvs; JSON caches todata/jsons.
Configuration check and simple tweet fetchers live in tests/.
Run:
uv run python tests/test_twitter_poster.py test_configuv run python tests/test_twitter_poster.py fetch_20