skillfed

tweepy

Library for accessing the X API (Twitter)

tweepy v4.17.0 4.7M downloads/30d#2,243 on PyPI11,177
Permissive license Active released

What it is and what it does

Tweepy is a mature Python wrapper around the X (Twitter) API that abstracts away the complexity of OAuth authentication and HTTP request formatting. It lets you write Python code to search tweets, retrieve user timelines, post updates, and manage followers without manually constructing API calls or handling token refresh cycles. The library depends on oauthlib, requests, and requests-oauthlib to handle the OAuth handshake and HTTP transport.

The package is designed for developers who need programmatic access to X data—whether for data collection, bot automation, or social media monitoring. It supports both synchronous and asynchronous workflows (via the optional async extra) and maintains compatibility with modern Python versions (3.9 and later). Since it's actively maintained and carries no known vulnerabilities, it's a stable choice for production use.

Use it for:

  • Collect tweets matching a search query or from a specific user's timeline for analysis or archival.
  • Build a Twitter bot that automatically posts updates or responds to mentions on a schedule.
  • Monitor brand mentions or hashtags in real-time and trigger alerts or logging based on tweet content.
  • Analyze social media trends by fetching historical tweet data and user engagement metrics.
  • Integrate X data into a larger application dashboard or reporting pipeline.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Tweepy is a Python library that provides access to the X (Twitter) API, handling authentication and request formatting so you can fetch tweets, post updates, and interact with user data programmatically.

Yes. Tweepy is a production-stable, actively maintained library with no security issues, low install friction, and permissive licensing. If you need programmatic access to the X API from Python, it's the standard choice and will save you from writing OAuth and HTTP plumbing yourself. Install it unless you have a specific reason to use a different X API client.

Install

tweepy on PyPI

pip

pip install tweepy

uv

uv add tweepy

poetry

poetry add tweepy

Installing tweepy

Before you install

Installation is straightforward with pip and carries low friction. The package is actively maintained with a recent release (43 days old) and an established repository with 11177 stars. It supports current Python versions (3.9 and later) and has no known security vulnerabilities.

License in practice

Tweepy is released under a permissive license, meaning you can use, modify, and distribute it freely in both open-source and commercial projects with minimal restrictions.

Quickstart

pip install tweepy

import tweepy

client = tweepy.Client(bearer_token="YOUR_BEARER_TOKEN")
tweets = client.get_users_mentions(id=user_id)
print(tweets.data)

You must obtain API credentials from the X Developer Portal and set a valid bearer token to authenticate requests.

Verify before relying

  • Whether the async extra (tweepy[async]) adds significant overhead or is necessary for your use case.
  • Rate limiting behavior and how the library handles X API quota exhaustion.
  • Support timeline for Python versions currently in bugfix/security phases.
  • Specific API endpoints and methods available in version 4.17.0.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 3 — oauthlib, requests, requests-oauthlib
Maintenance actively maintained — 43 days since the last release
Last repo commit
First released
Downloads 4,731,411/month — #2,243 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: tweepy-4.17.0-py3-none-any.whl

Keywords: X.com, API, Twitter

Development Status :: 5 - Production/StableLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries

Tags

twitter api python clientx api librarytweet fetching pythontwitter data accesssocial media api wrappertwitter authentication pythonpost tweets programmatically
social-media-apitwitter-clientoauth-wrapper

More Libraries packages