TweetKit#

TweetKit

Client Module#

Twitter API v2

class tweetkit.client.TwitterClient(auth)#

Bases: object

Twitter API Client.

Twitter API v2 available endpoints.

Notes

Please refer to the following for more information on using the Twitter API.
request(url, method='get', query=None, params=None, data=None, stream=False, paginate=False, **kwargs)#

Make request and get response.

Parameters:
  • url (str) – Request URL.

  • method (str) – Request method.

  • query (dict) – Request query.

  • params (dict) – Request params.

  • data (dict) – Request data.

  • stream (bool) – Whether to stream.

  • paginate (bool) – Whether to paginate.

  • kwargs (Any) – Other keyword arguments.

Return type:

TwitterResponse or generator of TwitterResponse

url = 'https://api.twitter.com'#
version = '2.51'#

Authentication Module#

Exceptions#

TwitterException

exception tweetkit.exceptions.JSONDecodeError(*args, **kwargs)#

Bases: TwitterException, JSONDecodeError

tweetkit.exceptions.ProblemOrError(*args, **kwargs)#

Create Problem or Error.

Returns:

error – Returns error or problem.

Return type:

TwitterError or TwitterProblem

exception tweetkit.exceptions.TwitterError(*args, **kwargs)#

Bases: TwitterRequestException

exception tweetkit.exceptions.TwitterException(*args, **kwargs)#

Bases: UserDict, Exception

property message#

Gets the message provided in message field.

This value will be overridden by kwargs provided.

Returns:

message – The message.

Return type:

str

exception tweetkit.exceptions.TwitterProblem(*args, **kwargs)#

Bases: TwitterRequestException

property code#

Gets code from status field of twitter problem response.

Returns:

code – The status code.

Return type:

int

property message#

Gets the message from detail field of twitter problem response.

Returns:

message – The message.

Return type:

str

exception tweetkit.exceptions.TwitterRequestException(*args, **kwargs)#

Bases: TwitterException, RequestException

There was an ambiguous exception that occurred while handling your request.

property code#

Gets code.

Returns:

code – The status code.

Return type:

int

exception tweetkit.exceptions.TwitterTimeoutException(*args, **kwargs)#

Bases: TwitterRequestException, Timeout