self.session = requests.Session()
def request(
- self, method, endpoint, *args, allowed_param=[], params=None,
+ self, method, endpoint, *args, allowed_param=(), params=None,
headers=None, json_payload=None, parser=None, payload_list=False,
payload_type=None, post_data=None, require_auth=True,
return_cursors=False, upload_api=False, use_cache=True, **kwargs
""" :reference: https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline
"""
return self.request(
- 'GET', 'statuses/home_timeline', *args,
- allowed_param=['count', 'since_id', 'max_id', 'trim_user',
- 'exclude_replies', 'include_entities'], **kwargs
+ 'GET', 'statuses/home_timeline', *args, allowed_param=(
+ 'count', 'since_id', 'max_id', 'trim_user', 'exclude_replies',
+ 'include_entities'
+ ), **kwargs
)
@payload('status', list=True)
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-lookup
"""
return self.request(
- 'GET', 'statuses/lookup', list_to_csv(id_), *args,
- allowed_param=['id', 'include_entities', 'trim_user', 'map',
- 'include_ext_alt_text', 'include_card_uri'],
- **kwargs
+ 'GET', 'statuses/lookup', list_to_csv(id_), *args, allowed_param=(
+ 'id', 'include_entities', 'trim_user', 'map',
+ 'include_ext_alt_text', 'include_card_uri'
+ ), **kwargs
)
@pagination(mode='id')
""" :reference: https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline
"""
return self.request(
- 'GET', 'statuses/user_timeline', *args,
- allowed_param=['user_id', 'screen_name', 'since_id', 'count',
- 'max_id', 'trim_user', 'exclude_replies',
- 'include_rts'], **kwargs
+ 'GET', 'statuses/user_timeline', *args, allowed_param=(
+ 'user_id', 'screen_name', 'since_id', 'count', 'max_id',
+ 'trim_user', 'exclude_replies', 'include_rts'
+ ), **kwargs
)
@pagination(mode='id')
""" :reference: https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-mentions_timeline
"""
return self.request(
- 'GET', 'statuses/mentions_timeline', *args,
- allowed_param=['since_id', 'max_id', 'count'], **kwargs
+ 'GET', 'statuses/mentions_timeline', *args, allowed_param=(
+ 'since_id', 'max_id', 'count'
+ ), **kwargs
)
@pagination(mode='id')
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets_of_me
"""
return self.request(
- 'GET', 'statuses/retweets_of_me', *args,
- allowed_param=['since_id', 'max_id', 'count'], **kwargs
+ 'GET', 'statuses/retweets_of_me', *args, allowed_param=(
+ 'since_id', 'max_id', 'count'
+ ), **kwargs
)
@payload('status')
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-show-id
"""
return self.request(
- 'GET', 'statuses/show', *args,
- allowed_param=['id', 'trim_user', 'include_my_retweet',
- 'include_entities', 'include_ext_alt_text',
- 'include_card_uri'], **kwargs
+ 'GET', 'statuses/show', *args, allowed_param=(
+ 'id', 'trim_user', 'include_my_retweet', 'include_entities',
+ 'include_ext_alt_text', 'include_card_uri'
+ ), **kwargs
)
@payload('status')
kwargs['media_ids'] = list_to_csv(kwargs['media_ids'])
return self.request(
- 'POST', 'statuses/update', *args,
- allowed_param=['status', 'in_reply_to_status_id',
- 'auto_populate_reply_metadata',
- 'exclude_reply_user_ids', 'attachment_url',
- 'media_ids', 'possibly_sensitive', 'lat', 'long',
- 'place_id', 'display_coordinates', 'trim_user',
- 'enable_dmcommands', 'fail_dmcommands',
- 'card_uri'], **kwargs
+ 'POST', 'statuses/update', *args, allowed_param=(
+ 'status', 'in_reply_to_status_id',
+ 'auto_populate_reply_metadata', 'exclude_reply_user_ids',
+ 'attachment_url', 'media_ids', 'possibly_sensitive', 'lat',
+ 'long', 'place_id', 'display_coordinates', 'trim_user',
+ 'enable_dmcommands', 'fail_dmcommands', 'card_uri'
+ ), **kwargs
)
@payload('media')
return self.request(
'POST', 'media/upload', *args,
- allowed_param=[],
+ allowed_param=(),
upload_api=True, **kwargs
)
return self.request(
'POST', 'media/metadata/create', *args,
- allowed_param=[],
+ allowed_param=(),
upload_api=True, **kwargs
)
kwargs.update({'headers': headers, 'post_data': post_data})
return self.request(
- 'POST', 'statuses/update_with_media', *args,
- allowed_param=['status', 'possibly_sensitive',
- 'in_reply_to_status_id',
- 'in_reply_to_status_id_str',
- 'auto_populate_reply_metadata', 'lat', 'long',
- 'place_id', 'display_coordinates'], **kwargs
+ 'POST', 'statuses/update_with_media', *args, allowed_param=(
+ 'status', 'possibly_sensitive', 'in_reply_to_status_id',
+ 'in_reply_to_status_id_str', 'auto_populate_reply_metadata',
+ 'lat', 'long', 'place_id', 'display_coordinates'
+ ), **kwargs
)
@payload('status')
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets-id
"""
return self.request(
- 'GET', f'statuses/retweets/{status_id}', *args,
- allowed_param=['count'], **kwargs
+ 'GET', f'statuses/retweets/{status_id}', *args, allowed_param=(
+ 'count',
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweeters-ids
"""
return self.request(
- 'GET', 'statuses/retweeters/ids', *args,
- allowed_param=['id', 'cursor', 'stringify_ids'], **kwargs
+ 'GET', 'statuses/retweeters/ids', *args, allowed_param=(
+ 'id', 'cursor', 'stringify_ids'
+ ), **kwargs
)
@payload('user')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-show
"""
return self.request(
- 'GET', 'users/show', *args,
- allowed_param=['id', 'user_id', 'screen_name'], **kwargs
+ 'GET', 'users/show', *args, allowed_param=(
+ 'id', 'user_id', 'screen_name'
+ ), **kwargs
)
@payload('json')
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-oembed
"""
return self.request(
- 'GET', 'statuses/oembed', *args,
- allowed_param=['url', 'maxwidth', 'hide_media', 'hide_thread',
- 'omit_script', 'align', 'related', 'lang', 'theme',
- 'link_color', 'widget_type', 'dnt'],
- require_auth=False, **kwargs
+ 'GET', 'statuses/oembed', *args, allowed_param=(
+ 'url', 'maxwidth', 'hide_media', 'hide_thread', 'omit_script',
+ 'align', 'related', 'lang', 'theme', 'link_color',
+ 'widget_type', 'dnt'
+ ), require_auth=False, **kwargs
)
@payload('user', list=True)
"""
return self.request(
'POST', 'users/lookup', list_to_csv(user_ids),
- list_to_csv(screen_names), *args,
- allowed_param=['user_id', 'screen_name', 'include_entities',
- 'tweet_mode'], **kwargs
+ list_to_csv(screen_names), *args, allowed_param=(
+ 'user_id', 'screen_name', 'include_entities', 'tweet_mode'
+ ), **kwargs
)
def me(self):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search
"""
return self.request(
- 'GET', 'users/search', *args,
- allowed_param=['q', 'count', 'page'], **kwargs
+ 'GET', 'users/search', *args, allowed_param=(
+ 'q', 'count', 'page'
+ ), **kwargs
)
@payload('direct_message')
""" :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-event
"""
return self.request(
- 'GET', 'direct_messages/events/show', *args,
- allowed_param=['id'], **kwargs
+ 'GET', 'direct_messages/events/show', *args, allowed_param=(
+ 'id',
+ ), **kwargs
)
@pagination(mode='dm_cursor')
""" :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/list-events
"""
return self.request(
- 'GET', 'direct_messages/events/list', *args,
- allowed_param=['count', 'cursor'], **kwargs
+ 'GET', 'direct_messages/events/list', *args, allowed_param=(
+ 'count', 'cursor'
+ ), **kwargs
)
@payload('direct_message')
""" :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message-event
"""
return self.request(
- 'DELETE', 'direct_messages/events/destroy', *args,
- allowed_param=['id'], **kwargs
+ 'DELETE', 'direct_messages/events/destroy', *args, allowed_param=(
+ 'id',
+ ), **kwargs
)
@payload('user')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-create
"""
return self.request(
- 'POST', 'friendships/create', *args,
- allowed_param=['id', 'user_id', 'screen_name', 'follow'], **kwargs
+ 'POST', 'friendships/create', *args, allowed_param=(
+ 'id', 'user_id', 'screen_name', 'follow'
+ ), **kwargs
)
@payload('user')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy
"""
return self.request(
- 'POST', 'friendships/destroy', *args,
- allowed_param=['id', 'user_id', 'screen_name'], **kwargs
+ 'POST', 'friendships/destroy', *args, allowed_param=(
+ 'id', 'user_id', 'screen_name'
+ ), **kwargs
)
@payload('friendship')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-show
"""
return self.request(
- 'GET', 'friendships/show', *args,
- allowed_param=['source_id', 'source_screen_name',
- 'target_id', 'target_screen_name'], **kwargs
+ 'GET', 'friendships/show', *args, allowed_param=(
+ 'source_id', 'source_screen_name', 'target_id',
+ 'target_screen_name'
+ ), **kwargs
)
@payload('relationship', list=True)
"""
return self.request(
'GET', 'friendships/lookup', list_to_csv(user_ids),
- list_to_csv(screen_names),
- allowed_param=['user_id', 'screen_name'], **kwargs
+ list_to_csv(screen_names), allowed_param=(
+ 'user_id', 'screen_name'
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-ids
"""
return self.request(
- 'GET', 'friends/ids', *args,
- allowed_param=['id', 'user_id', 'screen_name', 'cursor'], **kwargs
+ 'GET', 'friends/ids', *args, allowed_param=(
+ 'id', 'user_id', 'screen_name', 'cursor'
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-list
"""
return self.request(
- 'GET', 'friends/list', *args,
- allowed_param=['id', 'user_id', 'screen_name', 'cursor', 'count',
- 'skip_status', 'include_user_entities'], **kwargs
+ 'GET', 'friends/list', *args, allowed_param=(
+ 'id', 'user_id', 'screen_name', 'cursor', 'count',
+ 'skip_status', 'include_user_entities'
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-incoming
"""
return self.request(
- 'GET', 'friendships/incoming', *args,
- allowed_param=['cursor'], **kwargs
+ 'GET', 'friendships/incoming', *args, allowed_param=(
+ 'cursor',
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-outgoing
"""
return self.request(
- 'GET', 'friendships/outgoing', *args,
- allowed_param=['cursor'], **kwargs
+ 'GET', 'friendships/outgoing', *args, allowed_param=(
+ 'cursor',
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids
"""
return self.request(
- 'GET', 'followers/ids', *args,
- allowed_param=['id', 'user_id', 'screen_name', 'cursor', 'count'],
- **kwargs
+ 'GET', 'followers/ids', *args, allowed_param=(
+ 'id', 'user_id', 'screen_name', 'cursor', 'count'
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-list
"""
return self.request(
- 'GET', 'followers/list', *args,
- allowed_param=['id', 'user_id', 'screen_name', 'cursor', 'count',
- 'skip_status', 'include_user_entities'], **kwargs
+ 'GET', 'followers/list', *args, allowed_param=(
+ 'id', 'user_id', 'screen_name', 'cursor', 'count',
+ 'skip_status', 'include_user_entities'
+ ), **kwargs
)
@payload('json')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-settings
"""
return self.request(
- 'POST', 'account/settings', *args,
- allowed_param=['sleep_time_enabled', 'start_sleep_time',
- 'end_sleep_time', 'time_zone',
- 'trend_location_woeid',
- 'allow_contributor_request', 'lang'],
- use_cache=False, **kwargs
+ 'POST', 'account/settings', *args, allowed_param=(
+ 'sleep_time_enabled', 'start_sleep_time', 'end_sleep_time',
+ 'time_zone', 'trend_location_woeid',
+ 'allow_contributor_request', 'lang'
+ ), use_cache=False, **kwargs
)
@payload('user')
kwargs['include_email'] = str(kwargs['include_email']).lower()
try:
return self.request(
- 'GET', 'account/verify_credentials',
- allowed_param=['include_entities', 'skip_status',
- 'include_email'], **kwargs
+ 'GET', 'account/verify_credentials', allowed_param=(
+ 'include_entities', 'skip_status', 'include_email'
+ ), **kwargs
)
except TweepError as e:
if e.response is not None and e.response.status_code == 401:
""" :reference: https://developer.twitter.com/en/docs/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status
"""
return self.request(
- 'GET', 'application/rate_limit_status', *args,
- allowed_param=['resources'], use_cache=False, **kwargs
+ 'GET', 'application/rate_limit_status', *args, allowed_param=(
+ 'resources',
+ ), use_cache=False, **kwargs
)
@payload('user')
"""
headers, post_data = API._pack_image(filename, 700, f=file_)
return self.request(
- 'POST', 'account/update_profile_image', *args,
- allowed_param=['include_entities', 'skip_status'],
- post_data=post_data, headers=headers, **kwargs
+ 'POST', 'account/update_profile_image', *args, allowed_param=(
+ 'include_entities', 'skip_status'
+ ), post_data=post_data, headers=headers, **kwargs
)
def update_profile_banner(self, filename, **kwargs):
headers, post_data = API._pack_image(filename, 700,
form_field='banner', f=f)
return self.request(
- 'POST', 'account/update_profile_banner',
- allowed_param=['width', 'height', 'offset_left', 'offset_right'],
- post_data=post_data, headers=headers, **kwargs
+ 'POST', 'account/update_profile_banner', allowed_param=(
+ 'width', 'height', 'offset_left', 'offset_right'
+ ), post_data=post_data, headers=headers, **kwargs
)
@payload('user')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile
"""
return self.request(
- 'POST', 'account/update_profile', *args,
- allowed_param=['name', 'url', 'location', 'description',
- 'profile_link_color'], **kwargs
+ 'POST', 'account/update_profile', *args, allowed_param=(
+ 'name', 'url', 'location', 'description', 'profile_link_color'
+ ), **kwargs
)
@pagination(mode='id')
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-favorites-list
"""
return self.request(
- 'GET', 'favorites/list', *args,
- allowed_param=['screen_name', 'user_id', 'max_id', 'count',
- 'since_id'], **kwargs
+ 'GET', 'favorites/list', *args, allowed_param=(
+ 'screen_name', 'user_id', 'max_id', 'count', 'since_id'
+ ), **kwargs
)
@payload('status')
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-create
"""
return self.request(
- 'POST', 'favorites/create', *args,
- allowed_param=['id'], **kwargs
+ 'POST', 'favorites/create', *args, allowed_param=(
+ 'id',
+ ), **kwargs
)
@payload('status')
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-destroy
"""
return self.request(
- 'POST', 'favorites/destroy', *args,
- allowed_param=['id'], **kwargs
+ 'POST', 'favorites/destroy', *args, allowed_param=(
+ 'id',
+ ), **kwargs
)
@payload('user')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-create
"""
return self.request(
- 'POST', 'blocks/create', *args,
- allowed_param=['id', 'user_id', 'screen_name'], **kwargs
+ 'POST', 'blocks/create', *args, allowed_param=(
+ 'id', 'user_id', 'screen_name'
+ ), **kwargs
)
@payload('user')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-destroy
"""
return self.request(
- 'POST', 'blocks/destroy', *args,
- allowed_param=['id', 'user_id', 'screen_name'], **kwargs
+ 'POST', 'blocks/destroy', *args, allowed_param=(
+ 'id', 'user_id', 'screen_name'
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-ids
"""
return self.request(
- 'GET', 'mutes/users/ids', *args,
- allowed_param=['cursor'], **kwargs
+ 'GET', 'mutes/users/ids', *args, allowed_param=(
+ 'cursor',
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-list
"""
return self.request(
- 'GET', 'mutes/users/list', *args,
- allowed_param=['cursor', 'include_entities', 'skip_status'],
- **kwargs
+ 'GET', 'mutes/users/list', *args, allowed_param=(
+ 'cursor', 'include_entities', 'skip_status'
+ ), **kwargs
)
@payload('user')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-create
"""
return self.request(
- 'POST', 'mutes/users/create', *args,
- allowed_param=['id', 'user_id', 'screen_name'], **kwargs
+ 'POST', 'mutes/users/create', *args, allowed_param=(
+ 'id', 'user_id', 'screen_name'
+ ), **kwargs
)
@payload('user')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-destroy
"""
return self.request(
- 'POST', 'mutes/users/destroy', *args,
- allowed_param=['id', 'user_id', 'screen_name'], **kwargs
+ 'POST', 'mutes/users/destroy', *args, allowed_param=(
+ 'id', 'user_id', 'screen_name'
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-list
"""
return self.request(
- 'GET', 'blocks/list', *args,
- allowed_param=['cursor'], **kwargs
+ 'GET', 'blocks/list', *args, allowed_param=(
+ 'cursor',
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-ids
"""
return self.request(
- 'GET', 'blocks/ids', *args,
- allowed_param=['cursor'], **kwargs
+ 'GET', 'blocks/ids', *args, allowed_param=(
+ 'cursor',
+ ), **kwargs
)
@payload('user')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam
"""
return self.request(
- 'POST', 'users/report_spam', *args,
- allowed_param=['user_id', 'screen_name', 'perform_block'], **kwargs
+ 'POST', 'users/report_spam', *args, allowed_param=(
+ 'user_id', 'screen_name', 'perform_block'
+ ), **kwargs
)
@payload('saved_search', list=True)
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-saved_searches-create
"""
return self.request(
- 'POST', 'saved_searches/create', *args,
- allowed_param=['query'], **kwargs
+ 'POST', 'saved_searches/create', *args, allowed_param=(
+ 'query',
+ ), **kwargs
)
@payload('saved_search')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-create
"""
return self.request(
- 'POST', 'lists/create', *args,
- allowed_param=['name', 'mode', 'description'], **kwargs
+ 'POST', 'lists/create', *args, allowed_param=(
+ 'name', 'mode', 'description'
+ ), **kwargs
)
@payload('list')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy
"""
return self.request(
- 'POST', 'lists/destroy', *args,
- allowed_param=['owner_screen_name', 'owner_id', 'list_id', 'slug'],
- **kwargs
+ 'POST', 'lists/destroy', *args, allowed_param=(
+ 'owner_screen_name', 'owner_id', 'list_id', 'slug'
+ ), **kwargs
)
@payload('list')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-update
"""
return self.request(
- 'POST', 'lists/update', *args,
- allowed_param=['list_id', 'slug', 'name', 'mode', 'description',
- 'owner_screen_name', 'owner_id'], **kwargs
+ 'POST', 'lists/update', *args, allowed_param=(
+ 'list_id', 'slug', 'name', 'mode', 'description',
+ 'owner_screen_name', 'owner_id'
+ ), **kwargs
)
@payload('list', list=True)
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-list
"""
return self.request(
- 'GET', 'lists/list', *args,
- allowed_param=['screen_name', 'user_id', 'reverse'], **kwargs
+ 'GET', 'lists/list', *args, allowed_param=(
+ 'screen_name', 'user_id', 'reverse'
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-memberships
"""
return self.request(
- 'GET', 'lists/memberships', *args,
- allowed_param=['screen_name', 'user_id', 'filter_to_owned_lists',
- 'cursor', 'count'], **kwargs
+ 'GET', 'lists/memberships', *args, allowed_param=(
+ 'screen_name', 'user_id', 'filter_to_owned_lists', 'cursor',
+ 'count'
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships
"""
return self.request(
- 'GET', 'lists/ownerships', *args,
- allowed_param=['user_id', 'screen_name', 'count', 'cursor'],
- **kwargs
+ 'GET', 'lists/ownerships', *args, allowed_param=(
+ 'user_id', 'screen_name', 'count', 'cursor'
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscriptions
"""
return self.request(
- 'GET', 'lists/subscriptions', *args,
- allowed_param=['screen_name', 'user_id', 'cursor', 'count'],
- **kwargs
+ 'GET', 'lists/subscriptions', *args, allowed_param=(
+ 'screen_name', 'user_id', 'cursor', 'count'
+ ), **kwargs
)
@pagination(mode='id')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-statuses
"""
return self.request(
- 'GET', 'lists/statuses', *args,
- allowed_param=['owner_screen_name', 'slug', 'owner_id', 'list_id',
- 'since_id', 'max_id', 'count', 'include_entities',
- 'include_rts'], **kwargs
+ 'GET', 'lists/statuses', *args, allowed_param=(
+ 'owner_screen_name', 'slug', 'owner_id', 'list_id', 'since_id',
+ 'max_id', 'count', 'include_entities', 'include_rts'
+ ), **kwargs
)
@payload('list')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-show
"""
return self.request(
- 'GET', 'lists/show', *args,
- allowed_param=['owner_screen_name', 'owner_id', 'slug', 'list_id'],
- **kwargs
+ 'GET', 'lists/show', *args, allowed_param=(
+ 'owner_screen_name', 'owner_id', 'slug', 'list_id'
+ ), **kwargs
)
@payload('list')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create
"""
return self.request(
- 'POST', 'lists/members/create', *args,
- allowed_param=['screen_name', 'user_id', 'owner_screen_name',
- 'owner_id', 'slug', 'list_id'], **kwargs
+ 'POST', 'lists/members/create', *args, allowed_param=(
+ 'screen_name', 'user_id', 'owner_screen_name', 'owner_id',
+ 'slug', 'list_id'
+ ), **kwargs
)
@payload('list')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy
"""
return self.request(
- 'POST', 'lists/members/destroy', *args,
- allowed_param=['screen_name', 'user_id', 'owner_screen_name',
- 'owner_id', 'slug', 'list_id'], **kwargs
+ 'POST', 'lists/members/destroy', *args, allowed_param=(
+ 'screen_name', 'user_id', 'owner_screen_name', 'owner_id',
+ 'slug', 'list_id'
+ ), **kwargs
)
@payload('list')
return self.request(
'POST', 'lists/members/create_all', list_to_csv(screen_name),
list_to_csv(user_id), slug, list_id, owner_id, owner_screen_name,
- allowed_param=['screen_name', 'user_id', 'slug', 'list_id',
- 'owner_id', 'owner_screen_name'], **kwargs
+ allowed_param=(
+ 'screen_name', 'user_id', 'slug', 'list_id', 'owner_id',
+ 'owner_screen_name'
+ ), **kwargs
)
@payload('list')
return self.request(
'POST', 'lists/members/destroy_all', list_to_csv(screen_name),
list_to_csv(user_id), slug, list_id, owner_id, owner_screen_name,
- allowed_param=['screen_name', 'user_id', 'slug', 'list_id',
- 'owner_id', 'owner_screen_name'], **kwargs
+ allowed_param=(
+ 'screen_name', 'user_id', 'slug', 'list_id', 'owner_id',
+ 'owner_screen_name'
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members
"""
return self.request(
- 'GET', 'lists/members', *args,
- allowed_param=['owner_screen_name', 'slug', 'list_id', 'owner_id',
- 'cursor'], **kwargs
+ 'GET', 'lists/members', *args, allowed_param=(
+ 'owner_screen_name', 'slug', 'list_id', 'owner_id', 'cursor'
+ ), **kwargs
)
@payload('user')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members-show
"""
return self.request(
- 'GET', 'lists/members/show', *args,
- allowed_param=['list_id', 'slug', 'user_id', 'screen_name',
- 'owner_screen_name', 'owner_id'], **kwargs
+ 'GET', 'lists/members/show', *args, allowed_param=(
+ 'list_id', 'slug', 'user_id', 'screen_name',
+ 'owner_screen_name', 'owner_id'
+ ), **kwargs
)
@payload('list')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-create
"""
return self.request(
- 'POST', 'lists/subscribers/create', *args,
- allowed_param=['owner_screen_name', 'slug', 'owner_id', 'list_id'],
- **kwargs
+ 'POST', 'lists/subscribers/create', *args, allowed_param=(
+ 'owner_screen_name', 'slug', 'owner_id', 'list_id'
+ ), **kwargs
)
@payload('list')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-destroy
"""
return self.request(
- 'POST', 'lists/subscribers/destroy', *args,
- allowed_param=['owner_screen_name', 'slug', 'owner_id', 'list_id'],
- **kwargs
+ 'POST', 'lists/subscribers/destroy', *args, allowed_param=(
+ 'owner_screen_name', 'slug', 'owner_id', 'list_id'
+ ), **kwargs
)
@pagination(mode='cursor')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers
"""
return self.request(
- 'GET', 'lists/subscribers', *args,
- allowed_param=['owner_screen_name', 'slug', 'owner_id', 'list_id',
- 'cursor', 'count', 'include_entities',
- 'skip_status'], **kwargs
+ 'GET', 'lists/subscribers', *args, allowed_param=(
+ 'owner_screen_name', 'slug', 'owner_id', 'list_id', 'cursor',
+ 'count', 'include_entities', 'skip_status'
+ ), **kwargs
)
@payload('user')
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers-show
"""
return self.request(
- 'GET', 'lists/subscribers/show', *args,
- allowed_param=['owner_screen_name', 'slug', 'screen_name',
- 'owner_id', 'list_id', 'user_id'], **kwargs
+ 'GET', 'lists/subscribers/show', *args, allowed_param=(
+ 'owner_screen_name', 'slug', 'screen_name', 'owner_id',
+ 'list_id', 'user_id'
+ ), **kwargs
)
@payload('json')
""" :reference: https://developer.twitter.com/en/docs/trends/trends-for-location/api-reference/get-trends-place
"""
return self.request(
- 'GET', 'trends/place', *args,
- allowed_param=['id', 'exclude'], **kwargs
+ 'GET', 'trends/place', *args, allowed_param=(
+ 'id', 'exclude'
+ ), **kwargs
)
@payload('json')
""" :reference: https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-closest
"""
return self.request(
- 'GET', 'trends/closest', *args,
- allowed_param=['lat', 'long'], **kwargs
+ 'GET', 'trends/closest', *args, allowed_param=(
+ 'lat', 'long'
+ ), **kwargs
)
@pagination(mode='id')
""" :reference: https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets
"""
return self.request(
- 'GET', 'search/tweets', *args,
- allowed_param=['q', 'lang', 'locale', 'since_id', 'geocode',
- 'max_id', 'until', 'result_type', 'count',
- 'include_entities'], **kwargs
+ 'GET', 'search/tweets', *args, allowed_param=(
+ 'q', 'lang', 'locale', 'since_id', 'geocode', 'max_id',
+ 'until', 'result_type', 'count', 'include_entities'
+ ), **kwargs
)
@pagination(mode='next')
"""
return self.request(
'GET', f'tweets/search/30day/{environment_name}', *args,
- allowed_param=['query', 'tag', 'fromDate', 'toDate', 'maxResults',
- 'next'], **kwargs
+ allowed_param=(
+ 'query', 'tag', 'fromDate', 'toDate', 'maxResults', 'next'
+ ), **kwargs
)
@pagination(mode='next')
"""
return self.request(
'GET', f'tweets/search/fullarchive/{environment_name}', *args,
- allowed_param=['query', 'tag', 'fromDate', 'toDate', 'maxResults',
- 'next'], **kwargs
+ allowed_param=(
+ 'query', 'tag', 'fromDate', 'toDate', 'maxResults', 'next'
+ ), **kwargs
)
@payload('place', list=True)
""" :reference: https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-reverse_geocode
"""
return self.request(
- 'GET', 'geo/reverse_geocode', *args,
- allowed_param=['lat', 'long', 'accuracy', 'granularity',
- 'max_results'], **kwargs
+ 'GET', 'geo/reverse_geocode', *args, allowed_param=(
+ 'lat', 'long', 'accuracy', 'granularity', 'max_results'
+ ), **kwargs
)
@payload('place')
""" :reference: https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-search
"""
return self.request(
- 'GET', 'geo/search', *args,
- allowed_param=['lat', 'long', 'query', 'ip', 'granularity',
- 'accuracy', 'max_results', 'contained_within'],
- **kwargs
+ 'GET', 'geo/search', *args, allowed_param=(
+ 'lat', 'long', 'query', 'ip', 'granularity', 'accuracy',
+ 'max_results', 'contained_within'
+ ), **kwargs
)
@payload('json')