Skip to content

neldivad/xapi-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xapi-ex1 Quickstart

Minimal utilities to query TwitterAPI.io for followings and tweets, plus notebook helpers.

Setup

Using uv (recommended):

cd xapi-ex1
uv venv
source .venv/Scripts/activate
uv sync

Or 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 statsmodels

Create a .env with:

twitterapiio_key=YOUR_API_KEY

Fetch last tweets (advanced search wrapper)

from 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))

Notebook

  • Activate kernel for .venv, open notebooks/nb.ipynb, run cells.
  • CSVs save to data/csvs; JSON caches to data/jsons.

Tests

Configuration check and simple tweet fetchers live in tests/.

Run:

uv run python tests/test_twitter_poster.py test_config
uv run python tests/test_twitter_poster.py fetch_20

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors