Rekognize Twitter API Client

Rekognize is a Python Twitter REST API client for accessing Twitter data.


Install rekognize from PyPI.

pip install rekognize

Before you get started, you will need to authorize Rekognize Twitter application to obtain your ACCESS_TOKEN and ACCESS_TOKEN_SECRET.


Import client and initialize it:

from rekognize.twitter import UserClient


client = UserClient(

Then you can access Twitter REST API endpoints as follows:

# trends/available
>>> client.api.trends.available.get()

# users/search

# users/lookup
>>> r =


Alternatively, calls can be written in the following syntax:

>>> response = client.api['users/show'].get(screen_name='twitter')

rekognize is a read-only API. You can use it to access every GET endpoint of the Twitter REST API. Twitter API conditions such as the request parameter syntax and rate limits apply.


Calls to REST API return an ApiResponse object, which in addition to returned data, also gives you access to the remaining number of calls to the same endpoint (reset every 15 mins), response headers and the resource URL.           # decoded JSON data
response.resource_url   # resource URL
response.remaining      # remaining number of calls you can make to the same API endpoint; reset every 15 mins
response.headers        # dictionary containing response HTTP headers


There are 4 types of exceptions.

  • TwitterClientError raised for connection and access token retrieval errors
  • TwitterApiError raised when Twitter returns an error
  • TwitterAuthError raised when authentication fails, TwitterApiError subclass
  • TwitterRateLimitError raised when rate limit for resource is reached, TwitterApiError subclass
Get API keys To get your Rekognize client API keys, you need to authorize Rekognize Twitter application