Models#

TweetKit Modules

Includes implementations of TweetKit module methods.

Expansions Module#

ObjectStore

class tweetkit.models.expansions.TwitterExpansions(includes=None, **kwargs)#

Bases: object

add(data, dtype=None)#

Add to index.

expand(data, dtype=None)#

Creates a copy with expanded outputs.

get_includes(data)#

Gets mapping of includes used in the provided data.

property next_id#

Paginator Module#

Paginator

class tweetkit.models.paginator.Paginator(request)#

Bases: object

Paginator.

property content#

Iterator of objects.

Request Module#

Request

class tweetkit.models.request.TwitterRequest(url, method='get', query=None, params=None, data=None, stream=False, auth=None, scheduler=None, timeout=None, **kwargs)#

Bases: object

Request.

send(paginate=False)#

Response Module#

Response

class tweetkit.models.response.TwitterResponse(content, dtype=None, **kwargs)#

Bases: object

property content#

Gets list of objects or object dict.

property data#

Gets data from the response.

Returns:

The data of response.

Return type:

dict

property dtype#

Gets data-type of the response.

Returns:

The data-type of response.

Return type:

str

property errors#

Gets errors from the response.

Returns:

The errors of response.

Return type:

list of TwitterProblem

get(item, default=None)#

Gets item from data. Returns list if there are multiple objects in data.

Parameters:
  • item (str) – The key to extract the data.

  • default (Any) – The default return value.

Return type:

The data item referred by the provided key.

property includes#

Gets includes from the response.

Returns:

The includes of response.

Return type:

dict

property meta#

Gets errors from the response.

Returns:

The errors component of response.

Return type:

dict

to_json(path_or_buf=None, *args, **kwarg)#

Convert the object to a JSON string.

Parameters:

path_or_buf (str, path object, file-like object, or None, default None) – String, path object (implementing os.PathLike[str]), or file-like object implementing a write() function. If None, the result is returned as a string.

Returns:

If path_or_buf is None, returns the resulting json format as a string. Otherwise returns None.

Return type:

None or str

class tweetkit.models.response.TwitterStreamResponse(iter, **kwargs)#

Bases: object

close()#

Close the object.

Return type:

None

property content#

Iterator of objects.