import mimetypes
import os
-from tweepy.binder import bind_api, pagination
+from tweepy.binder import bind_api, pagination, payload
from tweepy.error import TweepError
from tweepy.parsers import ModelParser, Parser
from tweepy.utils import list_to_csv
)
@pagination(mode='id')
+ @payload('status', list=True)
def home_timeline(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline
:allowed_param: 'count', 'since_id', 'max_id', 'trim_user',
return bind_api(
*args, api=self,
path='/statuses/home_timeline.json',
- payload_type='status', payload_list=True,
allowed_param=['count', 'since_id', 'max_id', 'trim_user',
'exclude_replies', 'include_entities'],
require_auth=True, **kwargs
)
+ @payload('status', list=True)
def statuses_lookup(self, id_, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-lookup
:allowed_param: 'id', 'include_entities', 'trim_user', 'map',
return bind_api(
list_to_csv(id_), *args, api=self,
path='/statuses/lookup.json',
- payload_type='status', payload_list=True,
allowed_param=['id', 'include_entities', 'trim_user', 'map',
'include_ext_alt_text', 'include_card_uri'],
require_auth=True, **kwargs
)
@pagination(mode='id')
+ @payload('status', list=True)
def user_timeline(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline
:allowed_param: 'user_id', 'screen_name', 'since_id', 'count',
return bind_api(
*args, api=self,
path='/statuses/user_timeline.json',
- payload_type='status', payload_list=True,
allowed_param=['user_id', 'screen_name', 'since_id', 'count',
'max_id', 'trim_user', 'exclude_replies',
'include_rts'], **kwargs
)
@pagination(mode='id')
+ @payload('status', list=True)
def mentions_timeline(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-mentions_timeline
:allowed_param: 'since_id', 'max_id', 'count'
return bind_api(
*args, api=self,
path='/statuses/mentions_timeline.json',
- payload_type='status', payload_list=True,
allowed_param=['since_id', 'max_id', 'count'],
require_auth=True, **kwargs
)
@pagination(mode='id')
+ @payload('status', list=True)
def retweets_of_me(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets_of_me
:allowed_param: 'since_id', 'max_id', 'count'
return bind_api(
*args, api=self,
path='/statuses/retweets_of_me.json',
- payload_type='status', payload_list=True,
allowed_param=['since_id', 'max_id', 'count'],
require_auth=True, **kwargs
)
+ @payload('status')
def get_status(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-show-id
:allowed_param: 'id', 'trim_user', 'include_my_retweet',
return bind_api(
*args, api=self,
path='/statuses/show.json',
- payload_type='status',
allowed_param=['id', 'trim_user', 'include_my_retweet',
'include_entities', 'include_ext_alt_text',
'include_card_uri'], **kwargs
)
+ @payload('status')
def update_status(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update
:allowed_param: 'status', 'in_reply_to_status_id',
*args, api=self,
path='/statuses/update.json',
method='POST',
- payload_type='status',
allowed_param=['status', 'in_reply_to_status_id',
'auto_populate_reply_metadata',
'exclude_reply_user_ids', 'attachment_url',
require_auth=True, **kwargs
)
+ @payload('media')
def media_upload(self, filename, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-upload
:allowed_param:
*args, api=self,
path='/media/upload.json',
method='POST',
- payload_type='media',
allowed_param=[],
require_auth=True,
upload_api=True, **kwargs
upload_api=True, **kwargs
)
+ @payload('status')
def update_with_media(self, filename, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update_with_media
:allowed_param: 'status', 'possibly_sensitive',
*args, api=self,
path='/statuses/update_with_media.json',
method='POST',
- payload_type='status',
allowed_param=['status', 'possibly_sensitive',
'in_reply_to_status_id',
'in_reply_to_status_id_str',
require_auth=True, **kwargs
)
+ @payload('status')
def destroy_status(self, status_id, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-destroy-id
:allowed_param:
*args, api=self,
path=f'/statuses/destroy/{status_id}.json',
method='POST',
- payload_type='status',
require_auth=True, **kwargs
)
+ @payload('status')
def retweet(self, status_id, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-retweet-id
:allowed_param:
*args, api=self,
path=f'/statuses/retweet/{status_id}.json',
method='POST',
- payload_type='status',
require_auth=True, **kwargs
)
+ @payload('status')
def unretweet(self, status_id, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-unretweet-id
:allowed_param:
*args, api=self,
path=f'/statuses/unretweet/{status_id}.json',
method='POST',
- payload_type='status',
require_auth=True, **kwargs
)
+ @payload('status', list=True)
def retweets(self, status_id, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets-id
:allowed_param: 'count'
return bind_api(
*args, api=self,
path=f'/statuses/retweets/{status_id}.json',
- payload_type='status', payload_list=True,
allowed_param=['count'],
require_auth=True, **kwargs
)
@pagination(mode='cursor')
+ @payload('ids')
def retweeters(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweeters-ids
:allowed_param: 'id', 'cursor', 'stringify_ids
return bind_api(
*args, api=self,
path='/statuses/retweeters/ids.json',
- payload_type='ids',
allowed_param=['id', 'cursor', 'stringify_ids'], **kwargs
)
+ @payload('user')
def get_user(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-show
:allowed_param: 'id', 'user_id', 'screen_name'
return bind_api(
*args, api=self,
path='/users/show.json',
- payload_type='user',
allowed_param=['id', 'user_id', 'screen_name'], **kwargs
)
+ @payload('json')
def get_oembed(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-oembed
:allowed_param: 'url', 'maxwidth', 'hide_media', 'hide_thread',
return bind_api(
*args, api=self,
path='/statuses/oembed.json',
- payload_type='json',
allowed_param=['url', 'maxwidth', 'hide_media', 'hide_thread',
'omit_script', 'align', 'related', 'lang', 'theme',
'link_color', 'widget_type', 'dnt'], **kwargs
)
+ @payload('user', list=True)
def lookup_users(self, user_ids=None, screen_names=None, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup
:allowed_param: 'user_id', 'screen_name', 'include_entities',
return bind_api(
list_to_csv(user_ids), list_to_csv(screen_names), *args, api=self,
path='/users/lookup.json',
- payload_type='user', payload_list=True,
method='POST',
allowed_param=['user_id', 'screen_name', 'include_entities',
'tweet_mode'], **kwargs
return self.get_user(screen_name=self.auth.get_username())
@pagination(mode='page')
+ @payload('user', list=True)
def search_users(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search
:allowed_param: 'q', 'count', 'page'
return bind_api(
*args, api=self,
path='/users/search.json',
- payload_type='user', payload_list=True,
require_auth=True,
allowed_param=['q', 'count', 'page'], **kwargs
)
+ @payload('direct_message')
def get_direct_message(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-event
:allowed_param: 'id'
return bind_api(
*args, api=self,
path='/direct_messages/events/show.json',
- payload_type='direct_message',
allowed_param=['id'],
require_auth=True, **kwargs
)
@pagination(mode='dm_cursor')
+ @payload('direct_message', list=True)
def list_direct_messages(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/list-events
:allowed_param: 'count', 'cursor'
return bind_api(
*args, api=self,
path='/direct_messages/events/list.json',
- payload_type='direct_message', payload_list=True,
allowed_param=['count', 'cursor'],
require_auth=True, **kwargs
)
+ @payload('direct_message')
def send_direct_message(self, recipient_id, text, quick_reply_options=None,
attachment_type=None, attachment_media_id=None,
- ctas=None):
+ ctas=None, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event
:allowed_param: 'recipient_id', 'text', 'quick_reply_type',
'attachment_type', attachment_media_id'
api=self,
path='/direct_messages/events/new.json',
method='POST',
- payload_type='direct_message',
require_auth=True,
- json_payload=json_payload
+ json_payload=json_payload, **kwargs
)
def destroy_direct_message(self, *args, **kwargs):
require_auth=True, **kwargs
)
+ @payload('user')
def create_friendship(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-create
:allowed_param: 'id', 'user_id', 'screen_name', 'follow'
*args, api=self,
path='/friendships/create.json',
method='POST',
- payload_type='user',
allowed_param=['id', 'user_id', 'screen_name', 'follow'],
require_auth=True, **kwargs
)
+ @payload('user')
def destroy_friendship(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy
:allowed_param: 'id', 'user_id', 'screen_name'
*args, api=self,
path='/friendships/destroy.json',
method='POST',
- payload_type='user',
allowed_param=['id', 'user_id', 'screen_name'],
require_auth=True, **kwargs
)
+ @payload('friendship')
def show_friendship(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-show
:allowed_param: 'source_id', 'source_screen_name', 'target_id',
return bind_api(
*args, api=self,
path='/friendships/show.json',
- payload_type='friendship',
allowed_param=['source_id', 'source_screen_name',
'target_id', 'target_screen_name'], **kwargs
)
- def lookup_friendships(self, user_ids=None, screen_names=None):
+ @payload('relationship', list=True)
+ def lookup_friendships(self, user_ids=None, screen_names=None, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-lookup
:allowed_param: 'user_id', 'screen_name'
"""
return bind_api(
list_to_csv(user_ids), list_to_csv(screen_names), api=self,
path='/friendships/lookup.json',
- payload_type='relationship', payload_list=True,
allowed_param=['user_id', 'screen_name'],
- require_auth=True
+ require_auth=True, **kwargs
)
@pagination(mode='cursor')
+ @payload('ids')
def friends_ids(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-ids
:allowed_param: 'id', 'user_id', 'screen_name', 'cursor'
return bind_api(
*args, api=self,
path='/friends/ids.json',
- payload_type='ids',
allowed_param=['id', 'user_id', 'screen_name', 'cursor'], **kwargs
)
@pagination(mode='cursor')
+ @payload('user', list=True)
def friends(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-list
:allowed_param: 'id', 'user_id', 'screen_name', 'cursor', 'count',
return bind_api(
*args, api=self,
path='/friends/list.json',
- payload_type='user', payload_list=True,
allowed_param=['id', 'user_id', 'screen_name', 'cursor', 'count',
'skip_status', 'include_user_entities'], **kwargs
)
@pagination(mode='cursor')
+ @payload('ids')
def friendships_incoming(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-incoming
:allowed_param: 'cursor'
return bind_api(
*args, api=self,
path='/friendships/incoming.json',
- payload_type='ids',
allowed_param=['cursor'], **kwargs
)
@pagination(mode='cursor')
+ @payload('ids')
def friendships_outgoing(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-outgoing
:allowed_param: 'cursor'
return bind_api(
*args, api=self,
path='/friendships/outgoing.json',
- payload_type='ids',
allowed_param=['cursor'], **kwargs
)
@pagination(mode='cursor')
+ @payload('ids')
def followers_ids(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids
:allowed_param: 'id', 'user_id', 'screen_name', 'cursor', 'count'
return bind_api(
*args, api=self,
path='/followers/ids.json',
- payload_type='ids',
allowed_param=['id', 'user_id', 'screen_name', 'cursor', 'count'],
**kwargs
)
@pagination(mode='cursor')
+ @payload('user', list=True)
def followers(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-list
:allowed_param: 'id', 'user_id', 'screen_name', 'cursor', 'count',
return bind_api(
*args, api=self,
path='/followers/list.json',
- payload_type='user', payload_list=True,
allowed_param=['id', 'user_id', 'screen_name', 'cursor', 'count',
'skip_status', 'include_user_entities'], **kwargs
)
+ @payload('json')
def get_settings(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-settings """
return bind_api(
*args, api=self,
path='/account/settings.json',
- payload_type='json',
use_cache=False, **kwargs
)
+ @payload('json')
def set_settings(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-settings
:allowed_param: 'sleep_time_enabled', 'start_sleep_time',
*args, api=self,
path='/account/settings.json',
method='POST',
- payload_type='json',
allowed_param=['sleep_time_enabled', 'start_sleep_time',
'end_sleep_time', 'time_zone',
'trend_location_woeid',
use_cache=False, **kwargs
)
+ @payload('user')
def verify_credentials(self, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials
:allowed_param: 'include_entities', 'skip_status', 'include_email'
return bind_api(
api=self,
path='/account/verify_credentials.json',
- payload_type='user',
require_auth=True,
allowed_param=['include_entities', 'skip_status',
'include_email'], **kwargs
return False
raise
+ @payload('json')
def rate_limit_status(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status
:allowed_param: 'resources'
return bind_api(
*args, api=self,
path='/application/rate_limit_status.json',
- payload_type='json',
allowed_param=['resources'],
use_cache=False, **kwargs
)
- def update_profile_image(self, filename, file_=None):
+ @payload('user')
+ def update_profile_image(self, filename, file_=None, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image
:allowed_param: 'include_entities', 'skip_status'
"""
self, api=self,
path='/account/update_profile_image.json',
method='POST',
- payload_type='user',
allowed_param=['include_entities', 'skip_status'],
require_auth=True,
- post_data=post_data, headers=headers
+ post_data=post_data, headers=headers, **kwargs
)
def update_profile_banner(self, filename, **kwargs):
post_data=post_data, headers=headers
)
+ @payload('user')
def update_profile(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile
:allowed_param: 'name', 'url', 'location', 'description',
*args, api=self,
path='/account/update_profile.json',
method='POST',
- payload_type='user',
allowed_param=['name', 'url', 'location', 'description',
'profile_link_color'],
require_auth=True, **kwargs
)
@pagination(mode='id')
+ @payload('status', list=True)
def favorites(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-favorites-list
:allowed_param: 'screen_name', 'user_id', 'max_id', 'count',
return bind_api(
*args, api=self,
path='/favorites/list.json',
- payload_type='status', payload_list=True,
allowed_param=['screen_name', 'user_id', 'max_id', 'count',
'since_id'], **kwargs
)
+ @payload('status')
def create_favorite(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-create
:allowed_param: 'id'
*args, api=self,
path='/favorites/create.json',
method='POST',
- payload_type='status',
allowed_param=['id'],
require_auth=True, **kwargs
)
+ @payload('status')
def destroy_favorite(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-destroy
:allowed_param: 'id'
*args, api=self,
path='/favorites/destroy.json',
method='POST',
- payload_type='status',
allowed_param=['id'],
require_auth=True, **kwargs
)
+ @payload('user')
def create_block(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-create
:allowed_param: 'id', 'user_id', 'screen_name'
*args, api=self,
path='/blocks/create.json',
method='POST',
- payload_type='user',
allowed_param=['id', 'user_id', 'screen_name'],
require_auth=True, **kwargs
)
+ @payload('user')
def destroy_block(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-destroy
:allowed_param: 'id', 'user_id', 'screen_name'
*args, api=self,
path='/blocks/destroy.json',
method='POST',
- payload_type='user',
allowed_param=['id', 'user_id', 'screen_name'],
require_auth=True, **kwargs
)
@pagination(mode='cursor')
+ @payload('ids')
def mutes_ids(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-ids
:allowed_param: 'cursor'
return bind_api(
*args, api=self,
path='/mutes/users/ids.json',
- payload_type='ids',
allowed_param=['cursor'],
require_auth=True, **kwargs
)
@pagination(mode='cursor')
+ @payload('user', list=True)
def mutes(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-list
:allowed_param: 'cursor', 'include_entities', 'skip_status'
return bind_api(
*args, api=self,
path='/mutes/users/list.json',
- payload_type='user', payload_list=True,
allowed_param=['cursor', 'include_entities', 'skip_status'],
required_auth=True, **kwargs
)
+ @payload('user')
def create_mute(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-create
:allowed_param: 'id', 'user_id', 'screen_name'
*args, api=self,
path='/mutes/users/create.json',
method='POST',
- payload_type='user',
allowed_param=['id', 'user_id', 'screen_name'],
require_auth=True, **kwargs
)
+ @payload('user')
def destroy_mute(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-destroy
:allowed_param: 'id', 'user_id', 'screen_name'
*args, api=self,
path='/mutes/users/destroy.json',
method='POST',
- payload_type='user',
allowed_param=['id', 'user_id', 'screen_name'],
require_auth=True, **kwargs
)
@pagination(mode='cursor')
+ @payload('user', list=True)
def blocks(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-list
:allowed_param: 'cursor'
return bind_api(
*args, api=self,
path='/blocks/list.json',
- payload_type='user', payload_list=True,
allowed_param=['cursor'],
require_auth=True, **kwargs
)
@pagination(mode='cursor')
+ @payload('ids')
def blocks_ids(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-ids
:allowed_param: 'cursor'
return bind_api(
*args, api=self,
path='/blocks/ids.json',
- payload_type='ids',
allowed_param=['cursor'],
require_auth=True, **kwargs
)
+ @payload('user')
def report_spam(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam
:allowed_param: 'user_id', 'screen_name', 'perform_block'
*args, api=self,
path='/users/report_spam.json',
method='POST',
- payload_type='user',
allowed_param=['user_id', 'screen_name', 'perform_block'],
require_auth=True, **kwargs
)
+ @payload('saved_search', list=True)
def saved_searches(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-list """
return bind_api(
*args, api=self,
path='/saved_searches/list.json',
- payload_type='saved_search', payload_list=True,
require_auth=True, **kwargs
)
+ @payload('saved_search')
def get_saved_search(self, saved_search_id, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-show-id
:allowed_param:
return bind_api(
*args, api=self,
path=f'/saved_searches/show/{saved_search_id}.json',
- payload_type='saved_search',
require_auth=True, **kwargs
)
+ @payload('saved_search')
def create_saved_search(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-saved_searches-create
:allowed_param: 'query'
*args, api=self,
path='/saved_searches/create.json',
method='POST',
- payload_type='saved_search',
allowed_param=['query'],
require_auth=True, **kwargs
)
+ @payload('saved_search')
def destroy_saved_search(self, saved_search_id, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-saved_searches-destroy-id
:allowed_param:
*args, api=self,
path=f'/saved_searches/destroy/{saved_search_id}.json',
method='POST',
- payload_type='saved_search',
require_auth=True, **kwargs
)
+ @payload('list')
def create_list(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-create
:allowed_param: 'name', 'mode', 'description'
*args, api=self,
path='/lists/create.json',
method='POST',
- payload_type='list',
allowed_param=['name', 'mode', 'description'],
require_auth=True, **kwargs
)
+ @payload('list')
def destroy_list(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy
:allowed_param: 'owner_screen_name', 'owner_id', 'list_id', 'slug'
*args, api=self,
path='/lists/destroy.json',
method='POST',
- payload_type='list',
allowed_param=['owner_screen_name', 'owner_id', 'list_id', 'slug'],
require_auth=True, **kwargs
)
+ @payload('list')
def update_list(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-update
:allowed_param: 'list_id', 'slug', 'name', 'mode', 'description',
*args, api=self,
path='/lists/update.json',
method='POST',
- payload_type='list',
allowed_param=['list_id', 'slug', 'name', 'mode', 'description',
'owner_screen_name', 'owner_id'],
require_auth=True, **kwargs
)
+ @payload('list', list=True)
def lists_all(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-list
:allowed_param: 'screen_name', 'user_id', 'reverse'
return bind_api(
*args, api=self,
path='/lists/list.json',
- payload_type='list', payload_list=True,
allowed_param=['screen_name', 'user_id', 'reverse'],
require_auth=True, **kwargs
)
@pagination(mode='cursor')
+ @payload('list', list=True)
def lists_memberships(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-memberships
:allowed_param: 'screen_name', 'user_id', 'filter_to_owned_lists',
return bind_api(
*args, api=self,
path='/lists/memberships.json',
- payload_type='list', payload_list=True,
allowed_param=['screen_name', 'user_id', 'filter_to_owned_lists',
'cursor', 'count'],
require_auth=True, **kwargs
)
@pagination(mode='cursor')
+ @payload('list', list=True)
def lists_ownerships(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships
:allowed_param: 'user_id', 'screen_name', 'count', 'cursor'
return bind_api(
*args, api=self,
path='/lists/ownerships.json',
- payload_type='list', payload_list=True,
allowed_param=['user_id', 'screen_name', 'count', 'cursor'],
require_auth=True, **kwargs
)
@pagination(mode='cursor')
+ @payload('list', list=True)
def lists_subscriptions(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscriptions
:allowed_param: 'screen_name', 'user_id', 'cursor', 'count'
return bind_api(
*args, api=self,
path='/lists/subscriptions.json',
- payload_type='list', payload_list=True,
allowed_param=['screen_name', 'user_id', 'cursor', 'count'],
require_auth=True, **kwargs
)
@pagination(mode='id')
+ @payload('status', list=True)
def list_timeline(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-statuses
:allowed_param: 'owner_screen_name', 'slug', 'owner_id', 'list_id',
return bind_api(
*args, api=self,
path='/lists/statuses.json',
- payload_type='status', payload_list=True,
allowed_param=['owner_screen_name', 'slug', 'owner_id', 'list_id',
'since_id', 'max_id', 'count', 'include_entities',
'include_rts'], **kwargs
)
+ @payload('list')
def get_list(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-show
:allowed_param: 'owner_screen_name', 'owner_id', 'slug', 'list_id'
return bind_api(
*args, api=self,
path='/lists/show.json',
- payload_type='list',
allowed_param=['owner_screen_name', 'owner_id', 'slug', 'list_id'],
**kwargs
)
+ @payload('list')
def add_list_member(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create
:allowed_param: 'screen_name', 'user_id', 'owner_screen_name',
*args, api=self,
path='/lists/members/create.json',
method='POST',
- payload_type='list',
allowed_param=['screen_name', 'user_id', 'owner_screen_name',
'owner_id', 'slug', 'list_id'],
require_auth=True, **kwargs
)
+ @payload('list')
def remove_list_member(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy
:allowed_param: 'screen_name', 'user_id', 'owner_screen_name',
*args, api=self,
path='/lists/members/destroy.json',
method='POST',
- payload_type='list',
allowed_param=['screen_name', 'user_id', 'owner_screen_name',
'owner_id', 'slug', 'list_id'],
require_auth=True, **kwargs
)
+ @payload('list')
def add_list_members(self, screen_name=None, user_id=None, slug=None,
- list_id=None, owner_id=None, owner_screen_name=None):
+ list_id=None, owner_id=None, owner_screen_name=None,
+ **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create_all
:allowed_param: 'screen_name', 'user_id', 'slug', 'list_id',
'owner_id', 'owner_screen_name'
api=self,
path='/lists/members/create_all.json',
method='POST',
- payload_type='list',
allowed_param=['screen_name', 'user_id', 'slug', 'list_id',
'owner_id', 'owner_screen_name'],
- require_auth=True
+ require_auth=True, **kwargs
)
+ @payload('list')
def remove_list_members(self, screen_name=None, user_id=None, slug=None,
list_id=None, owner_id=None,
- owner_screen_name=None):
+ owner_screen_name=None, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy_all
:allowed_param: 'screen_name', 'user_id', 'slug', 'list_id',
'owner_id', 'owner_screen_name'
api=self,
path='/lists/members/destroy_all.json',
method='POST',
- payload_type='list',
allowed_param=['screen_name', 'user_id', 'slug', 'list_id',
'owner_id', 'owner_screen_name'],
- require_auth=True
+ require_auth=True, **kwargs
)
@pagination(mode='cursor')
+ @payload('user', list=True)
def list_members(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members
:allowed_param: 'owner_screen_name', 'slug', 'list_id', 'owner_id',
return bind_api(
*args, api=self,
path='/lists/members.json',
- payload_type='user', payload_list=True,
allowed_param=['owner_screen_name', 'slug', 'list_id', 'owner_id',
'cursor'], **kwargs
)
+ @payload('user')
def show_list_member(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members-show
:allowed_param: 'list_id', 'slug', 'user_id', 'screen_name',
return bind_api(
*args, api=self,
path='/lists/members/show.json',
- payload_type='user',
allowed_param=['list_id', 'slug', 'user_id', 'screen_name',
'owner_screen_name', 'owner_id'], **kwargs
)
+ @payload('list')
def subscribe_list(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-create
:allowed_param: 'owner_screen_name', 'slug', 'owner_id', 'list_id'
*args, api=self,
path='/lists/subscribers/create.json',
method='POST',
- payload_type='list',
allowed_param=['owner_screen_name', 'slug', 'owner_id', 'list_id'],
require_auth=True, **kwargs
)
+ @payload('list')
def unsubscribe_list(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-destroy
:allowed_param: 'owner_screen_name', 'slug', 'owner_id', 'list_id'
*args, api=self,
path='/lists/subscribers/destroy.json',
method='POST',
- payload_type='list',
allowed_param=['owner_screen_name', 'slug', 'owner_id', 'list_id'],
require_auth=True, **kwargs
)
@pagination(mode='cursor')
+ @payload('user', list=True)
def list_subscribers(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers
:allowed_param: 'owner_screen_name', 'slug', 'owner_id', 'list_id',
return bind_api(
*args, api=self,
path='/lists/subscribers.json',
- payload_type='user', payload_list=True,
allowed_param=['owner_screen_name', 'slug', 'owner_id', 'list_id',
'cursor', 'count', 'include_entities',
'skip_status'], **kwargs
)
+ @payload('user')
def show_list_subscriber(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers-show
:allowed_param: 'owner_screen_name', 'slug', 'screen_name',
return bind_api(
*args, api=self,
path='/lists/subscribers/show.json',
- payload_type='user',
allowed_param=['owner_screen_name', 'slug', 'screen_name',
'owner_id', 'list_id', 'user_id'], **kwargs
)
+ @payload('json')
def trends_available(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-available """
return bind_api(
*args, api=self,
path='/trends/available.json',
- payload_type='json', **kwargs
+ **kwargs
)
+ @payload('json')
def trends_place(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/trends/trends-for-location/api-reference/get-trends-place
:allowed_param: 'id', 'exclude'
return bind_api(
*args, api=self,
path='/trends/place.json',
- payload_type='json',
allowed_param=['id', 'exclude'], **kwargs
)
+ @payload('json')
def trends_closest(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-closest
:allowed_param: 'lat', 'long'
return bind_api(
*args, api=self,
path='/trends/closest.json',
- payload_type='json',
allowed_param=['lat', 'long'], **kwargs
)
@pagination(mode='id')
+ @payload('search_results')
def search(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets
:allowed_param: 'q', 'lang', 'locale', 'since_id', 'geocode',
return bind_api(
*args, api=self,
path='/search/tweets.json',
- payload_type='search_results',
allowed_param=['q', 'lang', 'locale', 'since_id', 'geocode',
'max_id', 'until', 'result_type', 'count',
'include_entities'], **kwargs
)
@pagination(mode='next')
+ @payload('status', list=True)
def search_30_day(self, environment_name, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/search/api-reference/premium-search
:allowed_param: 'query', 'tag', 'fromDate', 'toDate', 'maxResults',
return bind_api(
*args, api=self,
path=f'/tweets/search/30day/{environment_name}.json',
- payload_type='status', payload_list=True,
allowed_param=['query', 'tag', 'fromDate', 'toDate', 'maxResults',
'next'],
require_auth=True, **kwargs
)
@pagination(mode='next')
+ @payload('status', list=True)
def search_full_archive(self, environment_name, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/tweets/search/api-reference/premium-search
:allowed_param: 'query', 'tag', 'fromDate', 'toDate', 'maxResults',
return bind_api(
*args, api=self,
path=f'/tweets/search/fullarchive/{environment_name}.json',
- payload_type='status', payload_list=True,
allowed_param=['query', 'tag', 'fromDate', 'toDate', 'maxResults',
'next'],
require_auth=True, **kwargs
)
+ @payload('place', list=True)
def reverse_geocode(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-reverse_geocode
:allowed_param: 'lat', 'long', 'accuracy', 'granularity',
return bind_api(
*args, api=self,
path='/geo/reverse_geocode.json',
- payload_type='place', payload_list=True,
allowed_param=['lat', 'long', 'accuracy', 'granularity',
'max_results'], **kwargs
)
+ @payload('place')
def geo_id(self, place_id, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/geo/place-information/api-reference/get-geo-id-place_id
:allowed_param:
return bind_api(
*args, api=self,
path=f'/geo/id/{place_id}.json',
- payload_type='place', **kwargs
+ **kwargs
)
+ @payload('place', list=True)
def geo_search(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-search
:allowed_param: 'lat', 'long', 'query', 'ip', 'granularity',
return bind_api(
*args, api=self,
path='/geo/search.json',
- payload_type='place', payload_list=True,
allowed_param=['lat', 'long', 'query', 'ip', 'granularity',
'accuracy', 'max_results', 'contained_within'],
**kwargs
)
+ @payload('json')
def supported_languages(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/developer-utilities/supported-languages/api-reference/get-help-languages """
return bind_api(
*args, api=self,
path='/help/languages.json',
- payload_type='json',
require_auth=True, **kwargs
)
+ @payload('json')
def configuration(self, *args, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/developer-utilities/configuration/api-reference/get-help-configuration """
return bind_api(
*args, api=self,
path='/help/configuration.json',
- payload_type='json',
require_auth=True, **kwargs
)