Skip to main content

Submodules

Module contents

This module provides access to the stream endpoints of the X API and serves as the main entry point for all stream-related functionality.

class xdk.stream.StreamClient

Streaming Client for stream operations

Parameters

path.client
Client

__init__

Parameters

path.client
Client

get_rule_counts

Get stream rule counts Retrieves the count of rules in the active rule set for the filtered stream.

Parameters

path.rules_count_fields
List or None
default:"None"
A comma separated list of RulesCount fields to display.

Returns

GetRuleCountsResponse - Response data

get_rules

Get stream rules Retrieves the active rule set or a subset of rules for the filtered stream.

Parameters

path.ids
List or None
default:"None"
A comma-separated list of Rule IDs.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
str or None
default:"None"
This value is populated by passing the ‘next_token’ returned in a request to paginate through results.

Returns

GetRulesResponse - Response data

labels_compliance

Stream Post labels (Streaming) Streams all labeling events applied to Posts. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorLabelsComplianceResponse, None, None

likes_compliance

Stream Likes compliance data (Streaming) Streams all compliance data related to Likes for Users. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorLikesComplianceResponse, None, None

likes_firehose

Stream all Likes (Streaming) Streams all public Likes in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.partition
int
The partition number.
path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
path.like_with_tweet_author_fields
List or None
default:"None"
A comma separated list of LikeWithTweetAuthor fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorLikesFirehoseResponse, None, None

likes_sample10

Stream sampled Likes (Streaming) Streams a 10% sample of public Likes in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.partition
int
The partition number.
path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
path.like_with_tweet_author_fields
List or None
default:"None"
A comma separated list of LikeWithTweetAuthor fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorLikesSample10Response, None, None

posts

Stream filtered Posts (Streaming) Streams Posts in real-time matching the active rule set. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorPostsResponse, None, None

posts_compliance

Stream Posts compliance data (Streaming) Streams all compliance data related to Posts. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.partition
int
The partition number.
path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorPostsComplianceResponse, None, None

posts_firehose

Stream all Posts (Streaming) Streams all public Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.partition
int
The partition number.
path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorPostsFirehoseResponse, None, None

posts_firehose_en

Stream English Posts (Streaming) Streams all public English-language Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.partition
int
The partition number.
path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorPostsFirehoseEnResponse, None, None

posts_firehose_ja

Stream Japanese Posts (Streaming) Streams all public Japanese-language Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.partition
int
The partition number.
path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorPostsFirehoseJaResponse, None, None

posts_firehose_ko

Stream Korean Posts (Streaming) Streams all public Korean-language Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.partition
int
The partition number.
path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorPostsFirehoseKoResponse, None, None

posts_firehose_pt

Stream Portuguese Posts (Streaming) Streams all public Portuguese-language Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.partition
int
The partition number.
path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorPostsFirehosePtResponse, None, None

posts_sample

Stream sampled Posts (Streaming) Streams a 1% sample of public Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorPostsSampleResponse, None, None

posts_sample10

Stream 10% sampled Posts (Streaming) Streams a 10% sample of public Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.partition
int
The partition number.
path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorPostsSample10Response, None, None

update_rules

Update stream rules Adds or deletes rules from the active rule set for the filtered stream.

Parameters

body.body
UpdateRulesRequest
Request body

users_compliance

Stream Users compliance data (Streaming) Streams all compliance data related to Users. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream.

Parameters

path.partition
int
The partition number.
path.backfill_minutes
int or None
default:"None"
The number of minutes of backfill requested.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided.
path.timeout
float or None
default:"None"
Request timeout in seconds (default: None for no timeout)
path.chunk_size
int
default:"1024"
Size of chunks to read from the stream (default: 1024 bytes)

Returns

GeneratorUsersComplianceResponse, None, None