tweepy.API — Twitter API v1.1 Reference

class tweepy.API(auth=None, *, cache=None, host='api.twitter.com', parser=None, proxy=None, retry_count=0, retry_delay=0, retry_errors=None, timeout=60, upload_host='upload.twitter.com', user_agent=None, wait_on_rate_limit=False)

Twitter API v1.1 Interface

매개변수
  • auth – The authentication handler to be used

  • cache – The cache to query if a GET method is used

  • host – The general REST API host server URL

  • parser – The Parser instance to use for parsing the response from Twitter; defaults to an instance of ModelParser

  • proxy – The full url to an HTTPS proxy to use for connecting to Twitter

  • retry_count – Number of retries to attempt when an error occurs

  • retry_delay – Number of seconds to wait between retries

  • retry_errors – Which HTTP status codes to retry

  • timeout – 트위터로부터의 응답을 기다릴 최대 시간

  • upload_host – The URL of the upload server

  • wait_on_rate_limit – 트위터 API 호출 제한 횟수 보충을 기다릴지의 여부

예외 발생

TypeError – If the given parser is not a Parser instance

참조

https://developer.twitter.com/en/docs/api-reference-index

Twitter API v1.1 Endpoint

API Method

Premium Search APIs

GET search/30day/:label

API.search_30_day()

GET search/fullarchive/:label

API.search_full_archive()

Tweets

Get Tweet timelines

GET statuses/home_timeline

API.home_timeline()

GET statuses/mentions_timeline

API.mentions_timeline()

GET statuses/user_timeline

API.user_timeline()

Post, retrieve, and engage with Tweets

GET favorites/list

API.get_favorites()

GET statuses/lookup

API.lookup_statuses()

GET statuses/oembed

API.get_oembed()

GET statuses/retweeters/ids

API.get_retweeter_ids()

GET statuses/retweets/:id

API.get_retweets()

GET statuses/retweets_of_me

API.get_retweets_of_me()

GET statuses/show/:id

API.get_status()

POST favorites/create

API.create_favorite()

POST favorites/destroy

API.destroy_favorite()

POST statuses/destroy/:id

API.destroy_status()

POST statuses/retweet/:id

API.retweet()

POST statuses/unretweet/:id

API.unretweet()

POST statuses/update

API.update_status()

POST statuses/update_with_media

API.update_status_with_media()

Search Tweets

GET search/tweets

API.search_tweets()

Accounts and users

Create and manage lists

GET lists/list

API.get_lists()

GET lists/members

API.get_list_members()

GET lists/members/show

API.get_list_member()

GET lists/memberships

API.get_list_memberships()

GET lists/ownerships

API.get_list_ownerships()

GET lists/show

API.get_list()

GET lists/statuses

API.list_timeline()

GET lists/subscribers

API.get_list_subscribers()

GET lists/subscribers/show

API.get_list_subscriber()

GET lists/subscriptions

API.get_list_subscriptions()

POST lists/create

API.create_list()

POST lists/destroy

API.destroy_list()

POST lists/members/create

API.add_list_member()

POST lists/members/create_all

API.add_list_members()

POST lists/members/destroy

API.remove_list_member()

POST lists/members/destroy_all

API.remove_list_members()

POST lists/subscribers/create

API.subscribe_list()

POST lists/subscribers/destroy

API.unsubscribe_list()

POST lists/update

API.update_list()

Follow, search, and get users

GET followers/ids

API.get_follower_ids()

GET followers/list

API.get_followers()

GET friends/ids

API.get_friend_ids()

GET friends/list

API.get_friends()

GET friendships/incoming

API.incoming_friendships()

GET friendships/lookup

API.lookup_friendships()

GET friendships/no_retweets/ids

API.no_retweets_friendships()

GET friendships/outgoing

API.outgoing_friendships()

GET friendships/show

API.get_friendship()

GET users/lookup

API.lookup_users()

GET users/search

API.search_users()

GET users/show

API.get_user()

POST friendships/create

API.create_friendship()

POST friendships/destroy

API.destroy_friendship()

POST friendships/update

API.update_friendship()

Manage account settings and profile

GET account/settings

API.get_settings()

GET account/verify_credentials

API.verify_credentials()

GET saved_searches/list

API.get_saved_searches()

GET saved_searches/show/:id

API.get_saved_search()

GET users/profile_banner

API.get_profile_banner()

POST account/remove_profile_banner

API.remove_profile_banner()

POST account/settings

API.set_settings()

POST account/update_profile

API.update_profile()

POST account/update_profile_banner

API.update_profile_banner()

POST account/update_profile_image

API.update_profile_image()

POST saved_searches/create

API.create_saved_search()

POST saved_searches/destroy/:id

API.destroy_saved_search()

Mute, block, and report users

GET blocks/ids

API.get_blocked_ids()

GET blocks/list

API.get_blocks()

GET mutes/users/ids

API.get_muted_ids()

GET mutes/users/list

API.get_mutes()

POST blocks/create

API.create_block()

POST blocks/destroy

API.destroy_block()

POST mutes/users/create

API.create_mute()

POST mutes/users/destroy

API.destroy_mute()

POST users/report_spam

API.report_spam()

Direct Messages

Sending and receiving events

DELETE direct_messages/events/destroy

API.delete_direct_message()

GET direct_messages/events/list

API.get_direct_messages()

GET direct_messages/events/show

API.get_direct_message()

POST direct_messages/events/new

API.send_direct_message()

Media

Upload media

GET media/upload

API.get_media_upload_status()

POST media/metadata/create

API.create_media_metadata()

API.media_upload()

POST media/upload

API.simple_upload()

API.chunked_upload()

POST media/upload (APPEND)

API.chunked_upload_append()

POST media/upload (FINALIZE)

API.chunked_upload_finalize()

POST media/upload (INIT)

API.chunked_upload_init()

Trends

Get locations with trending topics

GET trends/available

API.available_trends()

GET trends/closest

API.closest_trends()

Get trends near a location

GET trends/place

API.get_place_trends()

Geo

Get information about a place

GET geo/id/:place_id

API.geo_id()

Get places near a location

GET geo/reverse_geocode

API.reverse_geocode()

GET geo/search

API.search_geo()

Developer utilities

Get Twitter supported languages

GET help/languages

API.supported_languages()

Get app rate limit status

GET application/rate_limit_status

API.rate_limit_status()

Premium Search APIs

API.search_30_day(label, query, *, tag, fromDate, toDate, maxResults, next)

Premium search that provides Tweets posted within the last 30 days.

매개변수
  • label – The (case-sensitive) label associated with your search developer environment, as displayed at https://developer.twitter.com/en/account/environments.

  • query

    The equivalent of one premium rule/filter, with up to 1,024 characters (256 with Sandbox dev environments).

    This parameter should include ALL portions of the rule/filter, including all operators, and portions of the rule should not be separated into other parameters of the query.

  • tag

    Tags can be used to segregate rules and their matching data into different logical groups. If a rule tag is provided, the rule tag is included in the 〈matching_rules〉 attribute.

    It is recommended to assign rule-specific UUIDs to rule tags and maintain desired mappings on the client side.

  • fromDate

    The oldest UTC timestamp (from most recent 30 days) from which the Tweets will be provided. Timestamp is in minute granularity and is inclusive (i.e. 12:00 includes the 00 minute).

    Specified: Using only the fromDate with no toDate parameter will deliver results for the query going back in time from now( ) until the fromDate.

    Not Specified: If a fromDate is not specified, the API will deliver all of the results for 30 days prior to now( ) or the toDate (if specified).

    If neither the fromDate or toDate parameter is used, the API will deliver all results for the most recent 30 days, starting at the time of the request, going backwards.

  • toDate

    The latest, most recent UTC timestamp to which the Tweets will be provided. Timestamp is in minute granularity and is not inclusive (i.e. 11:59 does not include the 59th minute of the hour).

    Specified: Using only the toDate with no fromDate parameter will deliver the most recent 30 days of data prior to the toDate.

    Not Specified: If a toDate is not specified, the API will deliver all of the results from now( ) for the query going back in time to the fromDate.

    If neither the fromDate or toDate parameter is used, the API will deliver all results for the entire 30-day index, starting at the time of the request, going backwards.

  • maxResults – The maximum number of search results to be returned by a request. A number between 10 and the system limit (currently 500, 100 for Sandbox environments). By default, a request response will return 100 results.

  • next – This parameter is used to get the next 〈page〉 of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified.

반환값

반환 형식

List[Status]

참조

https://developer.twitter.com/en/docs/twitter-api/premium/search-api/api-reference/premium-search

API.search_full_archive(label, query, *, tag, fromDate, toDate, maxResults, next)

Premium search that provides Tweets from as early as 2006, starting with the first Tweet posted in March 2006.

매개변수
  • label – The (case-sensitive) label associated with your search developer environment, as displayed at https://developer.twitter.com/en/account/environments.

  • query

    The equivalent of one premium rule/filter, with up to 1,024 characters (256 with Sandbox dev environments).

    This parameter should include ALL portions of the rule/filter, including all operators, and portions of the rule should not be separated into other parameters of the query.

  • tag

    Tags can be used to segregate rules and their matching data into different logical groups. If a rule tag is provided, the rule tag is included in the 〈matching_rules〉 attribute.

    It is recommended to assign rule-specific UUIDs to rule tags and maintain desired mappings on the client side.

  • fromDate

    The oldest UTC timestamp (from most recent 30 days) from which the Tweets will be provided. Timestamp is in minute granularity and is inclusive (i.e. 12:00 includes the 00 minute).

    Specified: Using only the fromDate with no toDate parameter will deliver results for the query going back in time from now( ) until the fromDate.

    Not Specified: If a fromDate is not specified, the API will deliver all of the results for 30 days prior to now( ) or the toDate (if specified).

    If neither the fromDate or toDate parameter is used, the API will deliver all results for the most recent 30 days, starting at the time of the request, going backwards.

  • toDate

    The latest, most recent UTC timestamp to which the Tweets will be provided. Timestamp is in minute granularity and is not inclusive (i.e. 11:59 does not include the 59th minute of the hour).

    Specified: Using only the toDate with no fromDate parameter will deliver the most recent 30 days of data prior to the toDate.

    Not Specified: If a toDate is not specified, the API will deliver all of the results from now( ) for the query going back in time to the fromDate.

    If neither the fromDate or toDate parameter is used, the API will deliver all results for the entire 30-day index, starting at the time of the request, going backwards.

  • maxResults – The maximum number of search results to be returned by a request. A number between 10 and the system limit (currently 500, 100 for Sandbox environments). By default, a request response will return 100 results.

  • next – This parameter is used to get the next 〈page〉 of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified.

반환값

반환 형식

List[Status]

참조

https://developer.twitter.com/en/docs/twitter-api/premium/search-api/api-reference/premium-search

Tweets

Get Tweet timelines

API.home_timeline(*, count, since_id, max_id, trim_user, exclude_replies, include_entities)

현재 인증된 사용자와 이 사용자의 친구들에 의해 작성된 Status 중, 가장 최근에 작성된 20개의 Status를 (리트윗을 포함해) 반환합니다. 웹 상에서의 /timeline/home와 동일합니다.

매개변수
  • count – 페이지 당 시도하고 검색할 결과의 수.

  • since_id – 지정한 ID보다 더 큰 ID값을 가지는 객체(즉, 지정한 객체보다 더 최근의 객체)만을 반환함.

  • max_id – 지정한 ID보다 더 작은 ID값을 가지는 객체(즉, 지정한 객체보다 더 이전의 객체)만을 반환함.

  • trim_user – 유저 ID가 반드시 유저 객체 대신 제공되어야 하는지를 나타내는 boolean 형태의 변수. 기본값은 False.

  • exclude_replies – This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count Tweets — this is because the count parameter retrieves that many Tweets before filtering out retweets and replies.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

반환값

반환 형식

List[Status]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/timelines/api-reference/get-statuses-home_timeline

API.mentions_timeline(*, count, since_id, max_id, trim_user, include_entities)

리트윗을 포함하는, 가장 최근의 멘션(답글) 20개를 반환합니다.

매개변수
  • count – 페이지 당 시도하고 검색할 결과의 수.

  • since_id – 지정한 ID보다 더 큰 ID값을 가지는 객체(즉, 지정한 객체보다 더 최근의 객체)만을 반환함.

  • max_id – 지정한 ID보다 더 작은 ID값을 가지는 객체(즉, 지정한 객체보다 더 이전의 객체)만을 반환함.

  • trim_user – 유저 ID가 반드시 유저 객체 대신 제공되어야 하는지를 나타내는 boolean 형태의 변수. 기본값은 False.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

반환값

반환 형식

List[Status]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/timelines/api-reference/get-statuses-mentions_timeline

API.user_timeline(*, user_id, screen_name, since_id, count, max_id, trim_user, exclude_replies, include_rts)

현재 인증된 사용자 또는 지정된 사용자의 Status 중 가장 최근의 20개를 반환합니다. `` id_`` 매개변수를 이용하면, 다른 사용자의 타임라인을 요청하는 것이 가능합니다.

매개변수
  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • since_id – 지정한 ID보다 더 큰 ID값을 가지는 객체(즉, 지정한 객체보다 더 최근의 객체)만을 반환함.

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • max_id – 지정한 ID보다 더 작은 ID값을 가지는 객체(즉, 지정한 객체보다 더 이전의 객체)만을 반환함.

  • trim_user – 유저 ID가 반드시 유저 객체 대신 제공되어야 하는지를 나타내는 boolean 형태의 변수. 기본값은 False.

  • exclude_replies – This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count Tweets — this is because the count parameter retrieves that many Tweets before filtering out retweets and replies.

  • include_rts – When set to false, the timeline will strip any native retweets (though they will still count toward both the maximal length of the timeline and the slice selected by the count parameter). Note: If you’re using the trim_user parameter in conjunction with include_rts, the retweets will still contain a full user object.

반환값

반환 형식

List[Status]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/timelines/api-reference/get-statuses-user_timeline

Post, retrieve, and engage with Tweets

API.get_favorites(*, user_id, screen_name, count, since_id, max_id, include_entities)

인증된 사용자 또는 ID 매개변수로 특정되는 사용자가 마음에 들어요를 누른 Status들을 반환합니다.

매개변수
  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • since_id – 지정한 ID보다 더 큰 ID값을 가지는 객체(즉, 지정한 객체보다 더 최근의 객체)만을 반환함.

  • max_id – 지정한 ID보다 더 작은 ID값을 가지는 객체(즉, 지정한 객체보다 더 이전의 객체)만을 반환함.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

반환값

반환 형식

List[Status]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-favorites-list

API.lookup_statuses(id, *, include_entities, trim_user, map, include_ext_alt_text, include_card_uri)

Returns full Tweet objects for up to 100 Tweets per request, specified by the id parameter.

매개변수
  • id – 반환받을 트윗의 ID 리스트(최대 100개).

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • trim_user – 유저 ID가 반드시 유저 객체 대신 제공되어야 하는지를 나타내는 boolean 형태의 변수. 기본값은 False.

  • map – A boolean indicating whether or not to include Tweets that cannot be shown. Defaults to False.

  • include_ext_alt_text – 미디어 요소에 alt 속성 값이 있으면 ext_alt_text를 반환. ext_alt_text는 미디어 요소의 상위 레벨 Key 값이 됨.

  • include_card_uri – (card_uri 값을 통한 일반 카드 및 광고 카드를 포함하는 트윗이 있다면) 가져온 트윗이 card_uri 값을 포함해야 하는지를 나타내는 boolean 형태의 변수.

반환값

반환 형식

List[Status]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-lookup

API.get_oembed(url, *, maxwidth, hide_media, hide_thread, omit_script, align, related, lang, theme, link_color, widget_type, dnt)

Returns a single Tweet, specified by either a Tweet web URL or the Tweet ID, in an oEmbed-compatible format. The returned HTML snippet will be automatically recognized as an Embedded Tweet when Twitter’s widget JavaScript is included on the page.

The oEmbed endpoint allows customization of the final appearance of an Embedded Tweet by setting the corresponding properties in HTML markup to be interpreted by Twitter’s JavaScript bundled with the HTML response by default. The format of the returned markup may change over time as Twitter adds new features or adjusts its Tweet representation.

The Tweet fallback markup is meant to be cached on your servers for up to the suggested cache lifetime specified in the cache_age.

매개변수
  • url – The URL of the Tweet to be embedded

  • maxwidth – The maximum width of a rendered Tweet in whole pixels. A supplied value under or over the allowed range will be returned as the minimum or maximum supported width respectively; the reset width value will be reflected in the returned width property. Note that Twitter does not support the oEmbed maxheight parameter. Tweets are fundamentally text, and are therefore of unpredictable height that cannot be scaled like an image or video. Relatedly, the oEmbed response will not provide a value for height. Implementations that need consistent heights for Tweets should refer to the hide_thread and hide_media parameters below.

  • hide_media – When set to true, "t", or 1, links in a Tweet are not expanded to photo, video, or link previews.

  • hide_thread – When set to true, "t", or 1, a collapsed version of the previous Tweet in a conversation thread will not be displayed when the requested Tweet is in reply to another Tweet.

  • omit_script – When set to true, "t", or 1, the <script> responsible for loading widgets.js will not be returned. Your webpages should include their own reference to widgets.js for use across all Twitter widgets including Embedded Tweets.

  • align – Specifies whether the embedded Tweet should be floated left, right, or center in the page relative to the parent element.

  • related – A comma-separated list of Twitter usernames related to your content. This value will be forwarded to Tweet action intents if a viewer chooses to reply, like, or retweet the embedded Tweet.

  • lang – Request returned HTML and a rendered Tweet in the specified Twitter language supported by embedded Tweets.

  • theme – When set to dark, the Tweet is displayed with light text over a dark background.

  • link_color – Adjust the color of Tweet text links with a hexadecimal color value.

  • widget_type – Set to video to return a Twitter Video embed for the given Tweet.

  • dnt – When set to true, the Tweet and its embedded page on your site are not used for purposes that include personalized suggestions and personalized ads.

반환값

JSON

반환 형식

dict

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-oembed

API.get_retweeter_ids(id, *, count, cursor, stringify_ids)

Returns up to 100 user IDs belonging to users who have retweeted the Tweet specified by the id parameter.

매개변수
  • id – status의 ID.

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

  • stringify_ids – Have IDs returned as strings instead

반환값

반환 형식

List[int]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-retweeters-ids

API.get_retweets(id, *, count, trim_user)

Returns up to 100 of the first Retweets of the given Tweet.

매개변수
  • id – status의 ID.

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • trim_user – 유저 ID가 반드시 유저 객체 대신 제공되어야 하는지를 나타내는 boolean 형태의 변수. 기본값은 False.

반환값

반환 형식

List[Status]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-retweets-id

API.get_retweets_of_me(*, count, since_id, max_id, trim_user, include_entities, include_user_entities)

Returns the 20 most recent Tweets of the authenticated user that have been retweeted by others.

매개변수
  • count – 페이지 당 시도하고 검색할 결과의 수.

  • since_id – 지정한 ID보다 더 큰 ID값을 가지는 객체(즉, 지정한 객체보다 더 최근의 객체)만을 반환함.

  • max_id – 지정한 ID보다 더 작은 ID값을 가지는 객체(즉, 지정한 객체보다 더 이전의 객체)만을 반환함.

  • trim_user – 유저 ID가 반드시 유저 객체 대신 제공되어야 하는지를 나타내는 boolean 형태의 변수. 기본값은 False.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • include_user_entities – False로 설정하면 유저 객체 노드가 포함되지 않음. 기본값은 True.

반환값

반환 형식

List[Status]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-retweets_of_me

API.get_status(id, *, trim_user, include_my_retweet, include_entities, include_ext_alt_text, include_card_uri)

ID 매개변수에 의해 구분된 하나의 Status 객체를 반환합니다.

매개변수
  • id – status의 ID.

  • trim_user – 유저 ID가 반드시 유저 객체 대신 제공되어야 하는지를 나타내는 boolean 형태의 변수. 기본값은 False.

  • include_my_retweet – boolean 형태의 변수. 현재 인증된 사용자에 의해 리트윗된 트윗이, 추가적으로 리트윗된 원본 트윗의 ID를 포함하는 current_user_retweet 노드를 포함해야 하는지를 지정합니다.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • include_ext_alt_text – 미디어 요소에 alt 속성 값이 있으면 ext_alt_text를 반환. ext_alt_text는 미디어 요소의 상위 레벨 Key 값이 됨.

  • include_card_uri – (card_uri 값을 통한 일반 카드 및 광고 카드를 포함하는 트윗이 있다면) 가져온 트윗이 card_uri 값을 포함해야 하는지를 나타내는 boolean 형태의 변수.

반환값

반환 형식

Status

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-show-id

API.create_favorite(id, *, include_entities)

Favorites the status specified in the id parameter as the authenticating user.

매개변수
  • id – status의 ID.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

반환값

반환 형식

Status

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-favorites-create

API.destroy_favorite(id, *, include_entities)

Un-favorites the status specified in the id parameter as the authenticating user.

매개변수
  • id – status의 ID.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

반환값

반환 형식

Status

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-favorites-destroy

API.destroy_status(id, *, trim_user)

Destroy the status specified by the id parameter. The authenticated user must be the author of the status to destroy.

매개변수
  • id – status의 ID.

  • trim_user – 유저 ID가 반드시 유저 객체 대신 제공되어야 하는지를 나타내는 boolean 형태의 변수. 기본값은 False.

반환값

반환 형식

Status

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-destroy-id

API.retweet(id, *, trim_user)

Retweets a Tweet. Requires the ID of the Tweet you are retweeting.

매개변수
  • id – status의 ID.

  • trim_user – 유저 ID가 반드시 유저 객체 대신 제공되어야 하는지를 나타내는 boolean 형태의 변수. 기본값은 False.

반환값

반환 형식

Status

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-retweet-id

API.unretweet(id, *, trim_user)

Untweets a retweeted status. Requires the ID of the retweet to unretweet.

매개변수
  • id – status의 ID.

  • trim_user – 유저 ID가 반드시 유저 객체 대신 제공되어야 하는지를 나타내는 boolean 형태의 변수. 기본값은 False.

반환값

반환 형식

Status

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-unretweet-id

API.update_status(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, card_uri)

현재 인증된 사용자의 Status를 업데이트합니다. 흔히 〈트윗을 작성한다’라고 불립니다.

Status 업데이트를 시도할 때 마다, 포함된 텍스트를 현재 인증된 사용자의 가장 최근 트윗과 비교합니다. 이에 따라, 중복된 업데이트 시도를 차단할 수 있으며, 이를 성공적으로 차단한 후에는 403 에러를 반환합니다. (참고: 사용자는 같은 Status 객체를 두 번 이상 연속해 게시할 수 없습니다.)

트위터 API상에서의 제한은 초과하지 않았으나, 사용자의 일일 트윗 작성 제한수를 초과하는 경우가 발생할 수 있습니다. 업데이트 시도가 이 제한을 초과할 경우에도, HTTP 403 에러를 반환받을 것입니다.

매개변수
  • status – 포함된 텍스트. Status 업데이트(트윗 작성)에 쓰입니다.

  • in_reply_to_status_id – 답글을 작성할 대상 트윗의 ID. (참고: 따로 값을 전달하지 않으면, 이 매개변수는 무시됩니다. 따라서, @username를 반드시 포함해야 하며, 이는 대상 트윗을 작성한 사람의 @username 이어야 합니다.)

  • auto_populate_reply_metadata – True로 설정되고 in_reply_to_status_id와 같이 사용되었을 경우, 원본 트윗에 달린 답글 @멘션을 찾아, 새 트윗을 그 곳에 추가합니다. @멘션은 @멘션 갯수 제한 이하에서, 트윗 타래가 〈확장된 트윗들의 메타데이터 형태’로 사용될 것입니다. 원본 트윗이 삭제되었을 경우, 반환값 생성이 실패할 수 있습니다.

  • exclude_reply_user_ids – auto_populate_reply_metadata와 같이 사용되었을 경우, 확장된 트윗(Extended Tweet)에서의 자동 생성된 멘션 대상 중 쉼표(,)로 구분된 사용자 ID를 삭제합니다. 답글 대상 멘션 대상은 제거될 수 없습니다. 이는 in_reply_to_status_id의 의미를 깨트릴 수 있습니다. 따라서 이 @멘션 ID를 제거하려는 시도는 무시됩니다.

  • attachment_url – URL이 Status 객체 중 확장된 트윗의 텍스트에 포함되지 않도록, 트윗에 첨부되는 형식으로 제공합니다. 이 URL은 트윗의 링크(Permalink) 또는 다이렉트 메세지(DM)의 깊은(Deep) 링크여야 합니다. 단, 트위터와 관련 없는 임의의 URL은 포함됩니다. 즉, attachment_url에 트윗의 링크 또는 다이렉트 메세지의 깊은 링크가 아닐 경우, 트윗 생성에 실패하며 예외를 발생시킬 것입니다.

  • media_ids – 트윗과 연결할 media_ids 의 리스트. 트윗 하나당 최대 4개의 이미지나 1개의 움직이는 GIF 형식의 이미지, 또는 1개의 동영상만을 포함시킬 수 있습니다.

  • possibly_sensitive – 민감한 콘텐츠인지 아닌지의 여부. 나체 사진 또는 수술 과정 사진 등의, 민감한 내용으로 여겨질 수 있는 미디어를 업로드할 경우 반드시 이 속성값을 True로 설정해야 합니다.

  • lat – 이 트윗이 가리킬 위치의 위도. -90.0 ~ +90.0 (북반구가 양수값) 범위 밖의 값은 무시되며, 아래의 long 매개변수가 지정되지 않은 경우에도 무시됩니다.

  • long – 이 트윗이 가리킬 위치의 경도. -180.0 ~ +180.0 (동쪽이 양수값) 범위 밖의 값, 숫자 이외의 값이 입력될 경우 무시되며, geo_enabled 가 비활성화 되었거나, 위의 lat 매개변수가 지정되지 않은 경우에도 전달된 값이 무시됩니다.

  • place_id – (사용자가 위치 정보를 사용할 수 있는 경우) 트윗이 작성된 위치의 정보 (ID).

  • display_coordinates – 트윗이 작성되어 전송된 위치를 표시할지 말지의 여부.

  • trim_user – 유저 ID가 반드시 유저 객체 대신 제공되어야 하는지를 나타내는 boolean 형태의 변수. 기본값은 False.

  • card_uri – 트윗에 card_uri 속성을 이용하여 광고 카드를 추가합니다.

반환값

반환 형식

Status

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-update

API.update_status_with_media(status, filename, *, file, possibly_sensitive, in_reply_to_status_id, lat, long, place_id, display_coordinates)

버전 3.7.0부터 폐지됨: Use API.media_upload() instead.

Update the authenticated user’s status. Statuses that are duplicates or too long will be silently ignored.

매개변수
  • status – 포함된 텍스트. Status 업데이트(트윗 작성)에 쓰입니다.

  • filename – The filename of the image to upload. This will automatically be opened unless file is specified.

  • file – A file object, which will be used instead of opening filename. filename is still required, for MIME type detection and to use as a form field in the POST data.

  • possibly_sensitive – Set to true for content which may not be suitable for every audience.

  • in_reply_to_status_id – 답글을 작성할 대상 트윗의 ID.

  • lat – 이 트윗이 가리킬 위치의 위도.

  • long – 이 트윗이 가리킬 위치의 경도.

  • place_id – (사용자가 위치 정보를 사용할 수 있는 경우) 트윗이 작성된 위치의 정보 (ID).

  • display_coordinates – 트윗이 작성되어 전송된 위치를 표시할지 말지의 여부.

반환값

반환 형식

Status

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-update_with_media

Search Tweets

API.search_tweets(q, *, geocode, lang, locale, result_type, count, until, since_id, max_id, include_entities)

지정한 쿼리와 관련된 트윗의 모음을 반환합니다.

트위터의 검색 서비스 및 검색 API가 모든 트윗을 대상으로 검색 작업을 수행하는 것은 아니라는 것을 유의하세요. 모든 트윗이 검색 인터페이스를 통해 색인화 되어있거나 검색할 수 있게 만들어져 있지는 않습니다.

API v1.1에서는, 검색 API의 응답 형식이 REST API나 플랫폼을 통해서 볼 수 있는 객체와 더 비슷한 트윗 객체를 반환하도록 향상되었습니다. 하지만, perspectival 속성(인증된 사용자에 의존하는 필드)은 현재 지원하지 않습니다.12

매개변수
  • q – The search query string of 500 characters maximum, including operators. Queries may additionally be limited by complexity.

  • geocode – Returns tweets by users located within a given radius of the given latitude/longitude. The location is preferentially taking from the Geotagging API, but will fall back to their Twitter profile. The parameter value is specified by 《latitude,longitude,radius》, where radius units must be specified as either 《mi》 (miles) or 《km》 (kilometers). Note that you cannot use the near operator via the API to geocode arbitrary locations; however you can use this geocode parameter to search near geocodes directly. A maximum of 1,000 distinct 《sub-regions》 will be considered when using the radius modifier.

  • lang – 트윗을 ISO 639-1 코드로 주어진 언어로 제한합니다. 언어 감지가 적절하게 작동했다고 전제합니다.

  • locale – 전송한 쿼리의 언어를 명시하세요. (현재는 ja만 유효합니다.) 이는 언어별 사용자를 위한 것이며 대부분의 경우엔 기본값이 적용됩니다.

  • result_type

    얻고 싶은 검색 결과의 형식에 대해 명시하세요. 현재 기본값은 《mixed》이며, 유효한 값은 다음과 같습니다:

    • mixed : include both popular and real time results in the response

    • 》recent》: 응답으로 가장 최근의 결과만을 반환합니다.

    • 》popular》: 응답으로 가장 인기 있는 결과만을 반환합니다.

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • until – 주어진 날짜 이전에 작성된 트윗을 반환합니다. 날짜는 YYYY-MM-DD의 형식으로 주어져야 합니다. 검색 색인은 7일 간만 유지됩니다. 다시 말해, 일주일 이상 지난 트윗은 찾을 수 없습니다.

  • since_id – Returns only statuses with an ID greater than (that is, more recent than) the specified ID. API를 통해서 접근할 수 있는 트윗의 수에는 제한이 있습니다. since_id 이후로 트윗 수 제한을 초과한다면, since_id 는 제한을 초과하지 않는 가장 오래된 ID로 강제 설정됩니다.

  • max_id – 지정한 ID보다 더 작은 ID값을 가지는 객체(즉, 지정한 객체보다 더 이전의 객체)만을 반환함.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

반환값

반환 형식

SearchResults

참조

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets

Accounts and users

Create and manage lists

API.get_lists(*, user_id, screen_name, reverse)

Returns all lists the authenticating or specified user subscribes to, including their own. The user is specified using the user_id or screen_name parameters. If no user is given, the authenticating user is used.

A maximum of 100 results will be returned by this call. Subscribed lists are returned first, followed by owned lists. This means that if a user subscribes to 90 lists and owns 20 lists, this method returns 90 subscriptions and 10 owned lists. The reverse method returns owned lists first, so with reverse=true, 20 owned lists and 80 subscriptions would be returned.

매개변수
  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • reverse – 소유 중인 리스트를 먼저 반환받을지의 여부. 기본값은 False.

반환값

반환 형식

List[List]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-list

API.get_list_members(*, list_id, slug, owner_screen_name, owner_id, count, cursor, include_entities, skip_status)

지정한 리스트에 속한 사람들을 반환합니다.

매개변수
  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • skip_status – 반환된 유저 객체에 Statuses를 포함할지 말지의 여부. 기본값은 False(포함하기).

반환값

반환 형식

List[User]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-members

API.get_list_member(*, list_id, slug, user_id, screen_name, owner_screen_name, owner_id, include_entities, skip_status)

지정한 사용자가, 지정한 리스트에 속해 있는지를 확인합니다.

매개변수
  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • skip_status – 반환된 유저 객체에 Statuses를 포함할지 말지의 여부. 기본값은 False(포함하기).

예외 발생

NotFound – The user is not a member of the list.

반환값

반환 형식

User

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-members-show

API.get_list_memberships(*, user_id, screen_name, count, cursor, filter_to_owned_lists)

Returns the lists the specified user has been added to. If user_id or screen_name are not provided, the memberships for the authenticating user are returned.

매개변수
  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

  • filter_to_owned_lists – A boolean indicating whether to return just lists the authenticating user owns, and the user represented by user_id or screen_name is a member of.

반환값

반환 형식

List[List]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-memberships

API.get_list_ownerships(*, user_id, screen_name, count, cursor)

Returns the lists owned by the specified user. Private lists will only be shown if the authenticated user is also the owner of the lists. If user_id and screen_name are not provided, the ownerships for the authenticating user are returned.

매개변수
  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

반환값

반환 형식

List[List]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships

API.get_list(*, list_id, slug, owner_screen_name, owner_id)

지정한 리스트를 반환합니다. 비공개(`` private`` ) 리스트일 경우, 현재 인증된 사용자가 지정한 리스트의 소유자여야만 합니다.

매개변수
  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

반환값

반환 형식

List

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-show

API.list_timeline(*, list_id, slug, owner_screen_name, owner_id, since_id, max_id, count, include_entities, include_rts)

Returns a timeline of Tweets authored by members of the specified list. Retweets are included by default. Use the include_rts=false parameter to omit retweets.

매개변수
  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

  • since_id – 지정한 ID보다 더 큰 ID값을 가지는 객체(즉, 지정한 객체보다 더 최근의 객체)만을 반환함.

  • max_id – 지정한 ID보다 더 작은 ID값을 가지는 객체(즉, 지정한 객체보다 더 이전의 객체)만을 반환함.

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • include_rts – A boolean indicating whether the list timeline will contain native retweets (if they exist) in addition to the standard stream of Tweets. The output format of retweeted Tweets is identical to the representation you see in home_timeline.

반환값

반환 형식

List[Status]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-statuses

API.get_list_subscribers(*, list_id, slug, owner_screen_name, owner_id, count, cursor, include_entities, skip_status)

지정한 리스트를 팔로우하는 사용자들을 반환합니다. 비공개(`` private`` ) 리스트일 경우, 현재 인증된 사용자가 지정한 리스트의 소유자여야만 합니다.

매개변수
  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • skip_status – 반환된 유저 객체에 Statuses를 포함할지 말지의 여부. 기본값은 False(포함하기).

반환값

반환 형식

List[User]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers

API.get_list_subscriber(*, owner_screen_name, owner_id, list_id, slug, user_id, screen_name, include_entities, skip_status)

지정한 사용자가, 지정한 리스트를 팔로우하고 있는지를 확인합니다.

매개변수
  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • skip_status – 반환된 유저 객체에 Statuses를 포함할지 말지의 여부. 기본값은 False(포함하기).

예외 발생

NotFound – The user is not a subscriber of the list.

반환값

반환 형식

User

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers-show

API.get_list_subscriptions(*, user_id, screen_name, count, cursor)

지정한 사용자가 팔로우하는 리스트들(기본적으로, 페이지 당 20개의 리스트가 있음)을 반환합니다. 단, 지정한 사용자가 소유하는 리스트는 포함되지 않습니다.

매개변수
  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

반환값

반환 형식

List[List]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-subscriptions

API.create_list(name, *, mode, description)

현재 인증된 사용자 계정에 새 리스트를 만듭니다. 리스트는 계정 당 최대 1000개까지만 생성 가능함을 유의하세요.

매개변수
  • name – 새 리스트의 이름

  • mode – 리스트의 공개 또는 비공개 여부. 인자로는 공개(public) 및 비공개(private)를 전달할 수 있으며, 기본값은 public.

  • description – 새 리스트의 설명.

반환값

반환 형식

List

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-create

API.destroy_list(*, owner_screen_name, owner_id, list_id, slug)

지정한 리스트를 삭제합니다. 삭제를 위해서는, 현재 인증된 사용자가 해당 리스트의 소유자여야 합니다.

매개변수
  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

반환값

반환 형식

List

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy

API.add_list_member(*, list_id, slug, user_id, screen_name, owner_screen_name, owner_id)

리스트에 사용자를 추가합니다. 리스트의 소유자만이 가능한 작업이며, 최대 5,000명까지만 추가 가능합니다.

매개변수
  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

반환값

반환 형식

List

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create

API.add_list_members(*, list_id, slug, user_id, screen_name, owner_screen_name, owner_id)

리스트에 사용자들을 추가합니다. 리스트의 소유자만이 가능한 작업이며, 최대 5,000명까지만 추가 가능합니다.

매개변수
  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

  • user_id – 쉼표(,)로 구분되는 user_id 들. 한 번에 최대 100개까지만 처리할 수 있습니다.

  • screen_name – 쉼표(,)로 구분되는 screen_name 들. 한 번에 최대 100개까지만 처리할 수 있습니다.

  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

반환값

반환 형식

List

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create_all

API.remove_list_member(*, list_id, slug, user_id, screen_name, owner_screen_name, owner_id)

리스트에서 지정한 사용자를 제거합니다. 리스트의 소유자만이 가능한 작업이며, 최대 5,000명까지만 추가 가능합니다.

매개변수
  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

반환값

반환 형식

List

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy

API.remove_list_members(*, list_id, slug, user_id, screen_name, owner_screen_name, owner_id)

리스트에서 지정한 사용자들을 제거합니다. 리스트의 소유자만이 가능한 작업이며, 최대 5,000명까지만 추가 가능합니다.

매개변수
  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

  • user_id – 쉼표(,)로 구분되는 user_id 들. 한 번에 최대 100개까지만 처리할 수 있습니다.

  • screen_name – 쉼표(,)로 구분되는 screen_name 들. 한 번에 최대 100개까지만 처리할 수 있습니다.

  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

반환값

반환 형식

List

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy_all

API.subscribe_list(*, owner_screen_name, owner_id, list_id, slug)

지정한 리스트를, 현재 인증된 사용자의 계정을 이용해 팔로우합니다.

매개변수
  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

반환값

반환 형식

List

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-create

API.unsubscribe_list(*, list_id, slug, owner_screen_name, owner_id)

지정한 리스트를, 현재 인증된 사용자의 계정을 이용해 언팔로우합니다.

매개변수
  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

반환값

반환 형식

List

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-destroy

API.update_list(*, list_id, slug, name, mode, description, owner_screen_name, owner_id)

지정한 리스트의 정보를 수정합니다. 갱신을 위해서는, 현재 인증된 사용자가 해당 리스트의 소유자여야 합니다.

매개변수
  • list_id – 리스트의 ID.

  • slug – 리스트 지정에 리스트 ID(`` list_id`` ) 대신 사용할 수 있습니다. 이를 사용할 경우, owner_id 또는 owner_screen_name 매개변수를 통해 목록 소유자도 지정해 주어야 함을 유의하세요.

  • name – 리스트의 이름.

  • mode – 리스트의 공개 또는 비공개 여부. 인자로는 공개(public) 및 비공개(private)를 전달할 수 있으며, 기본값은 public.

  • description – 리스트의 설명.

  • owner_screen_name – 슬러그에 의해 요청되는, 리스트 소유자인 사용자의 계정 이름.

  • owner_id – 슬러그에 의해 요청되는, 목록을 소유한 사용자의 ID.

반환값

반환 형식

List

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-update

Follow, search, and get users

API.get_follower_ids(*, user_id, screen_name, cursor, stringify_ids, count)

지정한 사용자를 팔로우하는 사용자들의 ID를 담은 배열을 반환합니다.

매개변수
  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

  • stringify_ids – Have IDs returned as strings instead

  • count – 페이지 당 시도하고 검색할 결과의 수.

반환값

반환 형식

List[int]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids

API.get_followers(*, user_id, screen_name, cursor, count, skip_status, include_user_entities)

대상 사용자의 팔로워 목록을, 목록에 추가된 순서대로, 요청 1회당 최대 100개씩 반환합니다. `` id`` 또는 screen_name 을 통해 대상을 지정하지 않으면, 현재 인증된 사용자를 대상으로 합니다.

매개변수
  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • skip_status – 반환된 유저 객체에 Statuses를 포함할지 말지의 여부. 기본값은 False(포함하기).

  • include_user_entities – False로 설정하면 유저 객체 노드가 포함되지 않음. 기본값은 True.

반환값

반환 형식

List[User]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-followers-list

API.get_friend_ids(*, user_id, screen_name, cursor, stringify_ids, count)

지정한 사용자가 팔로우한 사용자들의 ID를 담은 배열을 반환합니다.

매개변수
  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

  • stringify_ids – Have IDs returned as strings instead

  • count – 페이지 당 시도하고 검색할 결과의 수.

반환값

반환 형식

List[int]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friends-ids

API.get_friends(*, user_id, screen_name, cursor, count, skip_status, include_user_entities)

Returns a user’s friends ordered in which they were added 100 at a time. If no user is specified it defaults to the authenticated user.

매개변수
  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • skip_status – 반환된 유저 객체에 Statuses를 포함할지 말지의 여부. 기본값은 False(포함하기).

  • include_user_entities – False로 설정하면 유저 객체 노드가 포함되지 않음. 기본값은 True.

반환값

반환 형식

List[User]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friends-list

API.incoming_friendships(*, cursor, stringify_ids)

Returns a collection of numeric IDs for every user who has a pending request to follow the authenticating user.

매개변수
  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

  • stringify_ids – Have IDs returned as strings instead

반환값

반환 형식

List[int]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friendships-incoming

API.lookup_friendships(*, screen_name, user_id)

Returns the relationships of the authenticated user to the list of up to 100 screen_name or user_id provided.

매개변수
  • screen_name – `` screen_name`` 의 리스트이며, 이 역시 요청 1회당 최대 100개까지만 허용됨.

  • user_id – 사용자 ID 리스트이며, ID는 요청 1회당 최대 100개까지만 허용됨.

반환값

반환 형식

List[Relationship]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friendships-lookup

API.no_retweets_friendships(*, stringify_ids)

Returns a collection of user_ids that the currently authenticated user does not want to receive retweets from.

매개변수

stringify_ids – Have IDs returned as strings instead

반환값

반환 형식

List[int]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friendships-no_retweets-ids

API.outgoing_friendships(*, cursor, stringify_ids)

Returns a collection of numeric IDs for every protected user for whom the authenticating user has a pending follow request.

매개변수
  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

  • stringify_ids – Have IDs returned as strings instead

반환값

반환 형식

List[int]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friendships-outgoing

API.get_friendship(*, source_id, source_screen_name, target_id, target_screen_name)

두 사용자의 관계에 대한 자세한 정보를 반환합니다.

매개변수
  • source_id – 주 대상 사용자의 user_id

  • source_screen_name – 주 대상 사용자의 screen_name

  • target_id – 대상 사용자의 user_id

  • target_screen_name – 대상 사용자의 screen_name

반환값

반환 형식

Friendship

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friendships-show

API.lookup_users(*, screen_name, user_id, include_entities, tweet_mode)

매개변수에 의한 검색 기준을 충족하는 사용자 객체를 요청 1회당 최대 100개씩 반환합니다.

이 메소드를 사용할때는 아래 사항을 참고하세요.

  • You must be following a protected user to be able to see their most recent status update. If you don’t follow a protected user their status will be removed.

  • The order of user IDs or screen names may not match the order of users in the returned array.

  • If a requested user is unknown, suspended, or deleted, then that user will not be returned in the results list.

  • If none of your lookup criteria can be satisfied by returning a user object, a HTTP 404 will be thrown.

매개변수
  • screen_name – `` screen_name`` 의 리스트이며, 이 역시 요청 1회당 최대 100개까지만 허용됨.

  • user_id – 사용자 ID 리스트이며, ID는 요청 1회당 최대 100개까지만 허용됨.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • tweet_mode – 인자로 compat 또는 extended를 넘길 수 있으며,각각 140자 이상의 데이터가 포함된 트윗에 대해 호환성 모드(Compatibility Mode)와 확장 모드(Extended Mode)를 제공합니다.

반환값

반환 형식

List[User]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup

API.search_users(q, *, page, count, include_entities)

트위터의 〈사용자 검색〉 과 동일한 검색 기능을 실행합니다. 이 API를 이용한 검색은, 트위터에서 제공하는 것과 동일한 검색 결과를 반환합니다. 단, 최대 첫 1000개의 결과만 가져올 수 있습니다.

매개변수
  • q – The query to run against people search.

  • page – 검색할 페이지. (참고: 페이지 매김 제한 있음)

  • count – 페이지 당 시도하고 검색할 결과의 수.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

반환값

반환 형식

List[User]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-users-search

API.get_user(*, user_id, screen_name, include_entities)

지정한 사용자의 정보를 반환합니다.

매개변수
  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

반환값

반환 형식

User

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-users-show

API.create_friendship(*, screen_name, user_id, follow)

지정한 사용자와 친구를 맺습니다. (일명 팔로우)

매개변수
  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • follow – 지정한 사용자를 팔로우하고, 해당 사용자에 대한 알림을 활성화합니다.

반환값

반환 형식

User

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/post-friendships-create

API.destroy_friendship(*, screen_name, user_id)

지정한 사용자를 친구 삭제 합니다. (일명 언팔로우)

매개변수
  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

반환값

반환 형식

User

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy

API.update_friendship(*, screen_name, user_id, device, retweets)

Turn on/off Retweets and device notifications from the specified user.

매개변수
  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • device – Turn on/off device notifications from the target user.

  • retweets – Turn on/off Retweets from the target user.

반환값

반환 형식

Friendship

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/post-friendships-update

Manage account settings and profile

API.get_settings()

Returns settings (including current trend, geo and sleep time information) for the authenticating user.

반환값

JSON

반환 형식

dict

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/get-account-settings

API.verify_credentials(*, include_entities, skip_status, include_email)

제출한 사용자의 계정 사용 자격이 유효한지 판별합니다.

매개변수
  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • skip_status – 반환된 유저 객체에 Statuses를 포함할지 말지의 여부. 기본값은 False(포함하기).

  • include_email – True로 설정하면, 이메일이 문자열 형태로 User 객체에 포함되어 반환됩니다.

예외 발생

Unauthorized – Authentication unsuccessful

반환값

반환 형식

User

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials

API.get_saved_searches()

현재 인증된 사용자 계정에 저장된 검색어 쿼리를 반환합니다.

반환값

반환 형식

List[SavedSearch]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-list

Retrieve the data for a saved search owned by the authenticating user specified by the given ID.

매개변수

id – The ID of the saved search to be retrieved.

반환값

반환 형식

SavedSearch

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-show-id

API.get_profile_banner(*, user_id, screen_name)

Returns a map of the available size variations of the specified user’s profile banner. If the user has not uploaded a profile banner, a HTTP 404 will be served instead.

The profile banner data available at each size variant’s URL is in PNG format.

매개변수
  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

반환값

JSON

반환 형식

dict

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/get-users-profile_banner

API.remove_profile_banner()

Removes the uploaded profile banner for the authenticating user.

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/post-account-remove_profile_banner

API.set_settings(*, sleep_time_enabled, start_sleep_time, end_sleep_time, time_zone, trend_location_woeid, lang)

Updates the authenticating user’s settings.

매개변수
  • sleep_time_enabled – When set to true, t or 1 , will enable sleep time for the user. Sleep time is the time when push or SMS notifications should not be sent to the user.

  • start_sleep_time – The hour that sleep time should begin if it is enabled. The value for this parameter should be provided in ISO 8601 format (i.e. 00-23). The time is considered to be in the same timezone as the user’s time_zone setting.

  • end_sleep_time – The hour that sleep time should end if it is enabled. The value for this parameter should be provided in ISO 8601 format (i.e. 00-23). The time is considered to be in the same timezone as the user’s time_zone setting.

  • time_zone – The timezone dates and times should be displayed in for the user. The timezone must be one of the Rails TimeZone names.

  • trend_location_woeid – The Yahoo! Where On Earth ID to use as the user’s default trend location. Global information is available by using 1 as the WOEID.

  • lang – The language which Twitter should render in for this user. The language must be specified by the appropriate two letter ISO 639-1 representation.

반환값

JSON

반환 형식

dict

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/post-account-settings

API.update_profile(*, name, url, location, description, profile_link_color, include_entities, skip_status)

설정 페이지의 《계정》 탭에서 설정할 수 있는 값을 설정합니다.

매개변수
  • name – Full name associated with the profile.

  • url – URL associated with the profile. Will be prepended with http:// if not present

  • location – The city or country describing where the user of the account is located. The contents are not normalized or geocoded in any way.

  • description – A description of the user owning the account.

  • profile_link_color – Sets a hex value that controls the color scheme of links used on the authenticating user’s profile page on twitter.com. This must be a valid hexadecimal value, and may be either three or six characters (ex: F00 or FF0000).

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • skip_status – 반환된 유저 객체에 Statuses를 포함할지 말지의 여부. 기본값은 False(포함하기).

반환값

반환 형식

User

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile

API.update_profile_banner(filename, *, file, width, height, offset_left, offset_top)

Uploads a profile banner on behalf of the authenticating user.

매개변수
  • filename – The filename of the image to upload. This will automatically be opened unless file is specified.

  • file – A file object, which will be used instead of opening filename. filename is still required, for MIME type detection and to use as a form field in the POST data.

  • width – The width of the preferred section of the image being uploaded in pixels. Use with height, offset_left, and offset_top to select the desired region of the image to use.

  • height – The height of the preferred section of the image being uploaded in pixels. Use with width, offset_left, and offset_top to select the desired region of the image to use.

  • offset_left – The number of pixels by which to offset the uploaded image from the left. Use with height, width, and offset_top to select the desired region of the image to use.

  • offset_top – The number of pixels by which to offset the uploaded image from the top. Use with height, width, and offset_left to select the desired region of the image to use.

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_banner

API.update_profile_image(filename, *, file, include_entities, skip_status)

현재 인증된 사용자의 프로필 사진을 바꿉니다. 유효한 파일 형식은 다음과 같습니다: GIF, JPG, PNG

매개변수
  • filename – The filename of the image to upload. This will automatically be opened unless file is specified.

  • file – A file object, which will be used instead of opening filename. filename is still required, for MIME type detection and to use as a form field in the POST data.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • skip_status – 반환된 유저 객체에 Statuses를 포함할지 말지의 여부. 기본값은 False(포함하기).

반환값

반환 형식

User

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image

현재 인증된 사용자의 계정에 새 검색어를 저장합니다.

매개변수

query – 저장하고 싶은 검색어의 쿼리

반환값

반환 형식

SavedSearch

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/post-saved_searches-create

Destroys a saved search for the authenticated user. The search specified by ID must be owned by the authenticating user.

매개변수

id – The ID of the saved search to be deleted.

반환값

반환 형식

SavedSearch

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/post-saved_searches-destroy-id

Mute, block, and report users

API.get_blocked_ids(*, stringify_ids, cursor)

Returns an array of numeric user IDs the authenticating user is blocking.

매개변수
  • stringify_ids – Have IDs returned as strings instead

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

반환값

반환 형식

List[int]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/get-blocks-ids

API.get_blocks(*, include_entities, skip_status, cursor)

현재 인증된 사용자가 차단한 계정을 User 객체의 배열 형태로 반환합니다.

매개변수
  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • skip_status – 반환된 유저 객체에 Statuses를 포함할지 말지의 여부. 기본값은 False(포함하기).

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

반환값

반환 형식

List[User]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/get-blocks-list

API.get_muted_ids(*, stringify_ids, cursor)

Returns an array of numeric user IDs the authenticating user has muted.

매개변수
  • stringify_ids – Have IDs returned as strings instead

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

반환값

반환 형식

List[int]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-ids

API.get_mutes(*, cursor, include_entities, skip_status)

현재 인증된 사용자가 뮤트한 계정을 User 객체의 배열 형태로 반환합니다.

매개변수
  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • skip_status – 반환된 유저 객체에 Statuses를 포함할지 말지의 여부. 기본값은 False(포함하기).

반환값

반환 형식

List[User]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-list

API.create_block(*, screen_name, user_id, include_entities, skip_status)

Blocks the specified user from following the authenticating user. In addition the blocked user will not show in the authenticating users mentions or timeline (unless retweeted by another user). If a follow or friend relationship exists it is destroyed.

매개변수
  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • skip_status – 반환된 유저 객체에 Statuses를 포함할지 말지의 여부. 기본값은 False(포함하기).

반환값

반환 형식

User

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-blocks-create

API.destroy_block(*, screen_name, user_id, include_entities, skip_status)

ID로 지정한 사용자를, 현재 인증된 사용자의 계정에서 차단 해제합니다.

매개변수
  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • include_entities – False로 설정하면 엔티티 노드를 포함하지 않음. 기본값은 True.

  • skip_status – 반환된 유저 객체에 Statuses를 포함할지 말지의 여부. 기본값은 False(포함하기).

반환값

반환 형식

User

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-blocks-destroy

API.create_mute(*, screen_name, user_id)

ID로 지정한 사용자를, 현재 인증된 사용자의 계정에서 뮤트합니다.

매개변수
  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

반환값

반환 형식

User

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-create

API.destroy_mute(*, screen_name, user_id)

ID로 지정한 사용자를, 현재 인증된 사용자의 계정에서 뮤트 해제합니다.

매개변수
  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

반환값

반환 형식

User

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-destroy

API.report_spam(*, screen_name, user_id, perform_block)

Report the specified user as a spam account to Twitter.

매개변수
  • screen_name – 사용자 아이디(예: @pinkrabbit412에서의 pinkrabbit412 ). 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • user_id – 사용자 일련번호. 어떤 값이 유효한 사용자 아이디인지, 유효한 일련번호인지를 확실히 해야 할 때 도움이 됨.

  • perform_block – 신고한 계정을 차단할지 말지의 여부를 나타내는 boolean 형태의 변수. 기본값은 True.

반환값

반환 형식

User

참조

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam

Direct Messages

Sending and receiving events

API.delete_direct_message(id)

ID 매개변수가 지정하는 쪽지를 삭제합니다. 삭제하기 위해서는 인증된 사용자가 해당 DM의 수신자여야 합니다. 단, 쪽지는 사용자가 제공받는 인터페이스에서만 제거됩니다. 다시 말해, 대화에 참여한 다른 사용자는 이 삭제 작업 이후에도 해당 DM에 접근할 수 있습니다.

매개변수

id – The ID of the Direct Message that should be deleted.

참조

https://developer.twitter.com/en/docs/twitter-api/v1/direct-messages/sending-and-receiving/api-reference/delete-message-event

API.get_direct_messages(*, count, cursor)

최근 30일 이내의 모든 DM의 내역(송수신 모두)을 반환합니다. 반환값은 시간 역순으로 정렬되어 있습니다.

매개변수
  • count – 페이지 당 시도하고 검색할 결과의 수.

  • cursor – 결과를 페이지로 나누며, 페이징을 시작하려면 -1 값을 입력해야 합니다. 응답 내용의 next_cursor와 previous_cursor 속성의 반환값을 입력해서 목록의 페이지를 앞뒤로 옮길 수 있습니다.

반환값

반환 형식

List[DirectMessage]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/direct-messages/sending-and-receiving/api-reference/list-events

API.get_direct_message(id)

지정한 쪽지를 반환합니다.

매개변수

id – The ID of the Direct Message event that should be returned.

반환값

반환 형식

DirectMessage

참조

https://developer.twitter.com/en/docs/twitter-api/v1/direct-messages/sending-and-receiving/api-reference/get-event

API.send_direct_message(recipient_id, text, *, quick_reply_options, attachment_type, attachment_media_id, ctas)

현재 인증된 사용자의 계정으로, 지정한 사용자에게 쪽지를 보냅니다.

매개변수
  • recipient_id – 쪽지를 받을 사용자의 ID.

  • text – 쪽지의 내용(텍스트). 최대 10,000자까지 입력 가능.

  • quick_reply_options – Array of Options objects (20 max).

  • attachment_type – 컨텐츠 첨부 유형. 미디어나 위치 등이 될 수 있음.

  • attachment_media_id – 메시지와 연결할 미디어의 ID. 단, 쪽지는 하나의 미디어 ID만을 참조할 수 있음.

  • ctas – Array of 1-3 call-to-action (CTA) button objects

반환값

반환 형식

DirectMessage

참조

https://developer.twitter.com/en/docs/twitter-api/v1/direct-messages/sending-and-receiving/api-reference/new-event

Media

Upload media

API.get_media_upload_status(media_id)

Check on the progress of a chunked media upload. If the upload has succeeded, it’s safe to create a Tweet with this media_id.

매개변수

media_id – The ID of the media to check.

반환값

반환 형식

Media

참조

https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/get-media-upload-status

API.create_media_metadata(media_id, alt_text)

This endpoint can be used to provide additional information about the uploaded media_id. This feature is currently only supported for images and GIFs. Call this endpoint to attach additional metadata such as image alt text.

매개변수
  • media_id – alt 텍스트를 추가할 미디어의 ID.

  • alt_text – 이미지에 추가할 alt 텍스트.

참조

https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/post-media-metadata-create

API.media_upload(filename, *, file, chunked, media_category, additional_owners)

Use this to upload media to Twitter. This calls either API.simple_upload() or API.chunked_upload(). Chunked media upload is automatically used for videos. If chunked is set or the media is a video, wait_for_async_finalize can be specified as a keyword argument to be passed to API.chunked_upload().

매개변수
  • filename – The filename of the image to upload. This will automatically be opened unless file is specified.

  • file – A file object, which will be used instead of opening filename. filename is still required, for MIME type detection and to use as a form field in the POST data.

  • chunked – Whether or not to use chunked media upload. Videos use chunked upload regardless of this parameter. Defaults to False.

  • media_category – The category that represents how the media will be used. This field is required when using the media with the Ads API.

  • additional_owners – A list of user IDs to set as additional owners allowed to use the returned media_id in Tweet or Cards. Up to 100 additional owners may be specified.

반환값

반환 형식

Media

참조

https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/overview

API.simple_upload(filename, *, file, media_category, additional_owners)

Use this endpoint to upload media to Twitter. This does not use the chunked upload endpoints.

매개변수
  • filename – The filename of the image to upload. This will automatically be opened unless file is specified.

  • file – A file object, which will be used instead of opening filename. filename is still required, for MIME type detection and to use as a form field in the POST data.

  • media_category – The category that represents how the media will be used. This field is required when using the media with the Ads API.

  • additional_owners – A list of user IDs to set as additional owners allowed to use the returned media_id in Tweet or Cards. Up to 100 additional owners may be specified.

반환값

반환 형식

Media

참조

https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/post-media-upload

API.chunked_upload(filename, *, file, file_type, wait_for_async_finalize, media_category, additional_owners)

Use this to upload media to Twitter. This uses the chunked upload endpoints and calls API.chunked_upload_init(), API.chunked_upload_append(), and API.chunked_upload_finalize(). If wait_for_async_finalize is set, this calls API.get_media_upload_status() as well.

매개변수
  • filename – The filename of the image to upload. This will automatically be opened unless file is specified.

  • file – A file object, which will be used instead of opening filename. filename is still required, for MIME type detection and to use as a form field in the POST data.

  • file_type – The MIME type of the media being uploaded.

  • wait_for_async_finalize – Whether to wait for Twitter’s API to finish processing the media. Defaults to True.

  • media_category – The category that represents how the media will be used. This field is required when using the media with the Ads API.

  • additional_owners – A list of user IDs to set as additional owners allowed to use the returned media_id in Tweet or Cards. Up to 100 additional owners may be specified.

반환값

반환 형식

Media

참조

https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/uploading-media/chunked-media-upload

API.chunked_upload_append(media_id, media, segment_index)

Use this endpoint to upload a chunk (consecutive byte range) of the media file.

매개변수
  • media_id – The media_id returned from the initialization.

  • media – The raw binary file content being uploaded. It must be <= 5 MB.

  • segment_index – An ordered index of file chunk. It must be between 0-999 inclusive. The first segment has index 0, second segment has index 1, and so on.

참조

https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/post-media-upload-append

API.chunked_upload_finalize(media_id)

Use this endpoint after the entire media file is uploaded via appending. If (and only if) the response contains a processing_info field, it may also be necessary to check its status and wait for it to return success before proceeding to Tweet creation.

매개변수

media_id – The media_id returned from the initialization.

반환값

반환 형식

Media

참조

https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/post-media-upload-finalize

API.chunked_upload_init(total_bytes, media_type, *, media_category, additional_owners)

Use this endpoint to initiate a chunked file upload session.

매개변수
  • total_bytes – The size of the media being uploaded in bytes.

  • media_type – The MIME type of the media being uploaded.

  • media_category – The category that represents how the media will be used. This field is required when using the media with the Ads API.

  • additional_owners – A list of user IDs to set as additional owners allowed to use the returned media_id in Tweet or Cards. Up to 100 additional owners may be specified.

반환값

반환 형식

Media

참조

https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/post-media-upload-init

Geo

Get information about a place

API.geo_id(place_id)

Given place_id, provide more details about that place.

매개변수

place_id – 특정 위치에 대한, 유효한 Twitter ID.

반환값

반환 형식

Place

참조

https://developer.twitter.com/en/docs/twitter-api/v1/geo/place-information/api-reference/get-geo-id-place_id

Get places near a location

API.reverse_geocode(lat, long, *, accuracy, granularity, max_results)

Given a latitude and a longitude, searches for up to 20 places that can be used as a place_id when updating a status.

This request is an informative call and will deliver generalized results about geography.

매개변수
  • lat – 어떤 위치의 위도.

  • long – 어떤 위치의 경도.

  • accuracy – 검색할 《region》을 지정하는 수 형태의 변수. 기본적으로 미터(m) 단위로 인식되나, 접미어 ft 를 통해 피트(ft) 단위로 인식되게 할 수 있습니다.기본값은 0(0m)입니다.

  • granularity – Assumed to be neighborhood by default; can also be city.

  • max_results – 반환값의 갯수. 허용 범위를 초과하는 값일 경우, 무시됩니다.

반환값

반환 형식

List[Place]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/geo/places-near-location/api-reference/get-geo-reverse_geocode

API.search_geo(*, lat, long, query, ip, granularity, max_results)

Search for places that can be attached to a Tweet via API.update_status(). Given a latitude and a longitude pair, an IP address, or a name, this request will return a list of all the valid places that can be used as the place_id when updating a status.

Conceptually, a query can be made from the user’s location, retrieve a list of places, have the user validate the location they are at, and then send the ID of this location with a call to API.update_status().

This is the recommended method to use find places that can be attached to API.update_status(). Unlike API.reverse_geocode() which provides raw data access, this endpoint can potentially re-order places with regards to the user who is authenticated. This approach is also preferred for interactive place matching with the user.

Some parameters in this method are only required based on the existence of other parameters. For instance, lat is required if long is provided, and vice-versa.

매개변수
  • lat – The latitude to search around. This parameter will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will also be ignored if there isn’t a corresponding long parameter.

  • long – The longitude to search around. The valid ranges for longitude are -180.0 to +180.0 (East is positive) inclusive. This parameter will be ignored if outside that range, if it is not a number, if geo_enabled is turned off, or if there not a corresponding lat parameter.

  • query – Free-form text to match against while executing a geo-based query, best suited for finding nearby locations by name.

  • ip – An IP address. Used when attempting to fix geolocation based off of the user’s IP address.

  • granularity

    This is the minimal granularity of place types to return and must be one of: neighborhood, city, admin or country. If no granularity is provided for the request neighborhood is assumed.

    Setting this to city, for example, will find places which have a type of city, admin or country.

  • max_results – A hint as to the number of results to return. This does not guarantee that the number of results returned will equal max_results, but instead informs how many 《nearby》 results to return. Ideally, only pass in the number of places you intend to display to the user here.

반환값

반환 형식

List[Place]

참조

https://developer.twitter.com/en/docs/twitter-api/v1/geo/places-near-location/api-reference/get-geo-search

Developer utilities

Get Twitter supported languages

API.supported_languages()

Returns the list of languages supported by Twitter along with the language code supported by Twitter.

The language code may be formatted as ISO 639-1 alpha-2 (en), ISO 639-3 alpha-3 (msa), or ISO 639-1 alpha-2 combined with an ISO 3166-1 alpha-2 localization (zh-tw).

반환값

JSON

반환 형식

dict

참조

https://developer.twitter.com/en/docs/twitter-api/v1/developer-utilities/supported-languages/api-reference/get-help-languages

Get app rate limit status

API.rate_limit_status(*, resources)

지정한 리소스 그룹에 속하는 메소드들의 현재 한도 정보(Rate limit)를 반환합니다. 애플리케이션 전용 인증을 사용하고 있다면, 이 메소드의 응답은 애플리케이션 전용 인증 한도의 정보를 나타냅니다.

매개변수

resources – 현재 속도 제한의 처리를 알고 싶은 리소스 그룹을 쉼표(,)로 구분한 리스트

반환값

JSON

반환 형식

dict

참조

https://developer.twitter.com/en/docs/twitter-api/v1/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status

각주

1

https://web.archive.org/web/20170829051949/https://dev.twitter.com/rest/reference/get/search/tweets

2

https://twittercommunity.com/t/favorited-reports-as-false-even-if-status-is-already-favorited-by-the-user/11145