{"id":22483,"library":"twikit","title":"Twikit","description":"Twikit is an asynchronous Twitter API wrapper for Python that works without an official API key by scraping the web interface. Current version 2.3.3, updated frequently (multiple releases per month). Supports Python >=3.8.","status":"active","version":"2.3.3","language":"python","source_language":"en","source_url":"https://github.com/d60/twikit","tags":["twitter","api","async","scraper","unofficial"],"install":[{"cmd":"pip install twikit","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"HTTP client for async requests","package":"httpx","optional":false},{"reason":"Server-sent events support for real-time features","package":"httpx-sse","optional":false}],"imports":[{"note":"","wrong":"","symbol":"Client","correct":"from twikit import Client"}],"quickstart":{"code":"import asyncio\nfrom twikit import Client\n\nasync def main():\n    client = Client('en-US')\n    await client.login(auth_info_1='your_username', password='your_password')\n    user = await client.get_user_by_screen_name('example_user')\n    print(user.screen_name)\n\nasyncio.run(main())","lang":"python","description":"Login and fetch a user by screen name."},"warnings":[{"fix":"Wrap calls in async functions and use `await`. Install httpx[socks] if using proxies.","message":"From version 2.0.0, twikit switched from synchronous to asynchronous API. All methods must be awaited. Old sync code using `client.get_tweets()` will fail.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Add delays between requests, use random intervals, and rotate accounts if needed.","message":"Twikit can get rate-limited or have your account suspended if used aggressively. No official API means scraping is fragile.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace `client.get_tweets(user_id)` with `client.get_user_tweets(user_id)`.","message":"The `get_tweets()` method is deprecated. Use `get_user_tweets()` instead.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Pass `cookies` parameter or manual OTP entry via CLI.","message":"Login may require cookies if email confirmation or 2FA is enabled. The library does not handle OTP automatically.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `Client(language='en-US')` or simply `Client('en-US')` still works in 2.x but best to use keyword.","cause":"Older versions (<2.0) used `Client('en-US')` as positional. New version expects `lang` keyword.","error":"TypeError: Client() takes no arguments"},{"fix":"Use `from twikit import Client`.","cause":"Incorrect import path (e.g., `from twikit.client import Client`).","error":"AttributeError: module 'twikit' has no attribute 'Client'"},{"fix":"Add `time.sleep()` or use a delay between requests. Use rotating proxies.","cause":"Sending too many requests in a short time.","error":"twikit.errors.TooManyRequests: Rate limit exceeded"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}