+Find Twython useful? Consider supporting the author on Gittip: +
+ ++ +
+The quoted tweet text.Phil Gyford@philgyford""", - tweet_text) - - def test_retweet(self): - "With expand_quoted_status=True it should include a quoted tweet." - tweet_object = self.load_tweet('retweet') - tweet_text = self.api.html_for_tweet(tweet_object) - - self.assertEqual( - u"""My aunt and uncle in a very ill humour one with another, but I made shift with much ado to keep them from scolding.""", - tweet_text) - diff --git a/tests/tweets/basic.json b/tests/tweets/basic.json deleted file mode 100644 index 7243cd8..0000000 --- a/tests/tweets/basic.json +++ /dev/null @@ -1,170 +0,0 @@ -{ - "contributors":null, - "truncated":false, - "text":"http://t.co/FCmXyI6VHd is a #cool site, lol! @mikehelmick shd #checkitout. Love, @__twython__ https://t.co/67pwRvY6z9 http://t.co/N6InAO4B71", - "in_reply_to_status_id":null, - "id":349683012054683648, - "favorite_count":0, - "source":"Twitter Web Client", - "retweeted":false, - "coordinates":null, - "entities":{ - "symbols":[ - - ], - "user_mentions":[ - { - "id":29251354, - "indices":[ - 45, - 57 - ], - "id_str":"29251354", - "screen_name":"mikehelmick", - "name":"Mike Helmick" - }, - { - "id":1431865928, - "indices":[ - 81, - 93 - ], - "id_str":"1431865928", - "screen_name":"__twython__", - "name":"Twython" - } - ], - "hashtags":[ - { - "indices":[ - 28, - 33 - ], - "text":"cool" - }, - { - "indices":[ - 62, - 73 - ], - "text":"checkitout" - } - ], - "urls":[ - { - "url":"http://t.co/FCmXyI6VHd", - "indices":[ - 0, - 22 - ], - "expanded_url":"http://google.com", - "display_url":"google.com" - }, - { - "url":"https://t.co/67pwRvY6z9", - "indices":[ - 94, - 117 - ], - "expanded_url":"https://github.com", - "display_url":"github.com" - } - ], - "media":[ - { - "id":537884378513162240, - "id_str":"537884378513162240", - "indices":[ - 118, - 140 - ], - "media_url":"http://pbs.twimg.com/media/B3by_g-CQAAhrO5.jpg", - "media_url_https":"https://pbs.twimg.com/media/B3by_g-CQAAhrO5.jpg", - "url":"http://t.co/N6InAO4B71", - "display_url":"pic.twitter.com/N6InAO4B71", - "expanded_url":"http://twitter.com/pingofglitch/status/537884380060844032/photo/1", - "type":"photo", - "sizes":{ - "large":{ - "w":1024, - "h":640, - "resize":"fit" - }, - "thumb":{ - "w":150, - "h":150, - "resize":"crop" - }, - "medium":{ - "w":600, - "h":375, - "resize":"fit" - }, - "small":{ - "w":340, - "h":212, - "resize":"fit" - } - } - } - ] - }, - "in_reply_to_screen_name":null, - "id_str":"349683012054683648", - "retweet_count":0, - "in_reply_to_user_id":null, - "favorited":false, - "user":{ - "follow_request_sent":false, - "profile_use_background_image":true, - "default_profile_image":true, - "id":1431865928, - "verified":false, - "profile_text_color":"333333", - "profile_image_url_https":"https://si0.twimg.com/sticky/default_profile_images/default_profile_3_normal.png", - "profile_sidebar_fill_color":"DDEEF6", - "entities":{ - "description":{ - "urls":[ - - ] - } - }, - "followers_count":1, - "profile_sidebar_border_color":"C0DEED", - "id_str":"1431865928", - "profile_background_color":"3D3D3D", - "listed_count":0, - "profile_background_image_url_https":"https://si0.twimg.com/images/themes/theme1/bg.png", - "utc_offset":null, - "statuses_count":2, - "description":"", - "friends_count":1, - "location":"", - "profile_link_color":"0084B4", - "profile_image_url":"http://a0.twimg.com/sticky/default_profile_images/default_profile_3_normal.png", - "following":false, - "geo_enabled":false, - "profile_background_image_url":"http://a0.twimg.com/images/themes/theme1/bg.png", - "screen_name":"__twython__", - "lang":"en", - "profile_background_tile":false, - "favourites_count":0, - "name":"Twython", - "notifications":false, - "url":null, - "created_at":"Thu May 16 01:11:09 +0000 2013", - "contributors_enabled":false, - "time_zone":null, - "protected":false, - "default_profile":false, - "is_translator":false - }, - "geo":null, - "in_reply_to_user_id_str":null, - "possibly_sensitive":false, - "lang":"en", - "created_at":"Wed Jun 26 00:18:21 +0000 2013", - "in_reply_to_status_id_str":null, - "place":null -} diff --git a/tests/tweets/compat.json b/tests/tweets/compat.json deleted file mode 100644 index b01b358..0000000 --- a/tests/tweets/compat.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "contributors":null, - "truncated":true, - "text":"Say more about what's happening! Rolling out now: photos, videos, GIFs, polls, and Quote Tweets no longer count tow\u2026 https://t.co/SRmsuks2ru", - "is_quote_status":false, - "in_reply_to_status_id":null, - "id":777915304261193728, - "favorite_count":13856, - "source":"Twitter Web Client", - "retweeted":false, - "coordinates":null, - "entities":{ - "symbols":[ - - ], - "user_mentions":[ - - ], - "hashtags":[ - - ], - "urls":[ - { - "url":"https://t.co/SRmsuks2ru", - "indices":[ - 117, - 140 - ], - "expanded_url":"https://twitter.com/i/web/status/777915304261193728", - "display_url":"twitter.com/i/web/status/7\u2026" - } - ] - }, - "in_reply_to_screen_name":null, - "id_str":"777915304261193728", - "retweet_count":14767, - "in_reply_to_user_id":null, - "favorited":false, - "user":{ - "name":"Twitter", - "screen_name":"twitter" - }, - "geo":null, - "in_reply_to_user_id_str":null, - "possibly_sensitive":false, - "possibly_sensitive_appealable":false, - "lang":"en", - "created_at":"Mon Sep 19 17:00:36 +0000 2016", - "in_reply_to_status_id_str":null, - "place":null -} diff --git a/tests/tweets/entities_with_prefix.json b/tests/tweets/entities_with_prefix.json deleted file mode 100644 index 8ba8975..0000000 --- a/tests/tweets/entities_with_prefix.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "created_at":"Sat Jan 06 18:56:35 +0000 2018", - "id":949716340755091458, - "id_str":"949716340755091458", - "full_text":"@philgyford This is a test for @visionphil that includes a link https://t.co/sKw4J3A8SZ and #hashtag and X for good measure AND that is longer than 140 characters. https://t.co/jnQdy7Zg7u", - "truncated":false, - "display_text_range":[ 12, 187 ], - "entities":{ - "hashtags":[ - { - "text":"hashtag", - "indices":[ 92, 100 ] - } - ], - "symbols":[ ], - "user_mentions":[ - { - "screen_name":"philgyford", - "name":"Phil Gyford", - "id":12552, - "id_str":"12552", - "indices":[ 0, 11 ] - }, - { - "screen_name":"visionphil", - "name":"Vision Phil", - "id":104456050, - "id_str":"104456050", - "indices":[ 31, 42 ] - } - ], - "urls":[ - { - "url":"https://t.co/sKw4J3A8SZ", - "expanded_url":"http://example.org", - "display_url":"example.org", - "indices":[ 64, 87 ] - }, - { - "url":"https://t.co/jnQdy7Zg7u", - "expanded_url":"http://example.com", - "display_url":"example.com", - "indices":[ 164, 187 ] - } - ] - }, - "source":"Tweetbot for Mac", - "in_reply_to_status_id":948561036889722880, - "in_reply_to_status_id_str":"948561036889722880", - "in_reply_to_user_id":12552, - "in_reply_to_user_id_str":"12552", - "in_reply_to_screen_name":"philgyford", - "user":{ - "id":2030131, - "id_str":"2030131" - }, - "geo":null, - "coordinates":null, - "place":null, - "contributors":null, - "is_quote_status":false, - "retweet_count":0, - "favorite_count":0, - "favorited":false, - "retweeted":false, - "possibly_sensitive":false, - "lang":"en" -} diff --git a/tests/tweets/extended.json b/tests/tweets/extended.json deleted file mode 100644 index 105700a..0000000 --- a/tests/tweets/extended.json +++ /dev/null @@ -1,204 +0,0 @@ -{ - "full_text":"Say more about what's happening! Rolling out now: photos, videos, GIFs, polls, and Quote Tweets no longer count toward your 140 characters. https://t.co/I9pUC0NdZC", - "truncated":false, - "is_quote_status":false, - "in_reply_to_status_id":null, - "id":777915304261193728, - "favorite_count":13856, - "contributors":null, - "source":"Twitter Web Client", - "retweeted":false, - "coordinates":null, - "entities":{ - "symbols":[ - - ], - "user_mentions":[ - - ], - "hashtags":[ - - ], - "urls":[ - - ], - "media":[ - { - "expanded_url":"https://twitter.com/twitter/status/777915304261193728/photo/1", - "sizes":{ - "small":{ - "h":340, - "w":340, - "resize":"fit" - }, - "large":{ - "h":700, - "w":700, - "resize":"fit" - }, - "medium":{ - "h":600, - "w":600, - "resize":"fit" - }, - "thumb":{ - "h":150, - "w":150, - "resize":"crop" - } - }, - "url":"https://t.co/I9pUC0NdZC", - "media_url_https":"https://pbs.twimg.com/tweet_video_thumb/Csu1TzEVMAAAEv7.jpg", - "id_str":"777914712382058496", - "indices":[ - 140, - 163 - ], - "media_url":"http://pbs.twimg.com/tweet_video_thumb/Csu1TzEVMAAAEv7.jpg", - "type":"photo", - "id":777914712382058496, - "display_url":"pic.twitter.com/I9pUC0NdZC" - } - ] - }, - "in_reply_to_screen_name":null, - "id_str":"777915304261193728", - "display_text_range":[ - 0, - 139 - ], - "retweet_count":14767, - "in_reply_to_user_id":null, - "favorited":false, - "user":{ - "follow_request_sent":false, - "has_extended_profile":false, - "profile_use_background_image":true, - "id":783214, - "verified":true, - "profile_text_color":"333333", - "profile_image_url_https":"https://pbs.twimg.com/profile_images/767879603977191425/29zfZY6I_normal.jpg", - "profile_sidebar_fill_color":"F6F6F6", - "is_translator":false, - "geo_enabled":true, - "entities":{ - "url":{ - "urls":[ - { - "url":"http://t.co/5iRhy7wTgu", - "indices":[ - 0, - 22 - ], - "expanded_url":"http://blog.twitter.com/", - "display_url":"blog.twitter.com" - } - ] - }, - "description":{ - "urls":[ - { - "url":"https://t.co/qq1HEzvnrA", - "indices":[ - 84, - 107 - ], - "expanded_url":"http://support.twitter.com", - "display_url":"support.twitter.com" - } - ] - } - }, - "followers_count":56827498, - "protected":false, - "location":"San Francisco, CA", - "default_profile_image":false, - "id_str":"783214", - "lang":"en", - "utc_offset":-25200, - "statuses_count":3161, - "description":"Your official source for news, updates and tips from Twitter, Inc. Need help? Visit https://t.co/qq1HEzvnrA.", - "friends_count":145, - "profile_link_color":"226699", - "profile_image_url":"http://pbs.twimg.com/profile_images/767879603977191425/29zfZY6I_normal.jpg", - "notifications":false, - "profile_background_image_url_https":"https://pbs.twimg.com/profile_background_images/657090062/l1uqey5sy82r9ijhke1i.png", - "profile_background_color":"ACDED6", - "profile_banner_url":"https://pbs.twimg.com/profile_banners/783214/1471929200", - "profile_background_image_url":"http://pbs.twimg.com/profile_background_images/657090062/l1uqey5sy82r9ijhke1i.png", - "name":"Twitter", - "is_translation_enabled":false, - "profile_background_tile":true, - "favourites_count":2332, - "screen_name":"twitter", - "url":"http://t.co/5iRhy7wTgu", - "created_at":"Tue Feb 20 14:35:54 +0000 2007", - "contributors_enabled":false, - "time_zone":"Pacific Time (US & Canada)", - "profile_sidebar_border_color":"FFFFFF", - "default_profile":false, - "following":false, - "listed_count":90445 - }, - "geo":null, - "in_reply_to_user_id_str":null, - "possibly_sensitive":false, - "possibly_sensitive_appealable":false, - "lang":"en", - "created_at":"Mon Sep 19 17:00:36 +0000 2016", - "in_reply_to_status_id_str":null, - "place":null, - "extended_entities":{ - "media":[ - { - "expanded_url":"https://twitter.com/twitter/status/777915304261193728/photo/1", - "display_url":"pic.twitter.com/I9pUC0NdZC", - "url":"https://t.co/I9pUC0NdZC", - "media_url_https":"https://pbs.twimg.com/tweet_video_thumb/Csu1TzEVMAAAEv7.jpg", - "video_info":{ - "aspect_ratio":[ - 1, - 1 - ], - "variants":[ - { - "url":"https://pbs.twimg.com/tweet_video/Csu1TzEVMAAAEv7.mp4", - "bitrate":0, - "content_type":"video/mp4" - } - ] - }, - "id_str":"777914712382058496", - "sizes":{ - "small":{ - "h":340, - "w":340, - "resize":"fit" - }, - "large":{ - "h":700, - "w":700, - "resize":"fit" - }, - "medium":{ - "h":600, - "w":600, - "resize":"fit" - }, - "thumb":{ - "h":150, - "w":150, - "resize":"crop" - } - }, - "indices":[ - 140, - 163 - ], - "type":"animated_gif", - "id":777914712382058496, - "media_url":"http://pbs.twimg.com/tweet_video_thumb/Csu1TzEVMAAAEv7.jpg" - } - ] - } -} diff --git a/tests/tweets/identical_urls.json b/tests/tweets/identical_urls.json deleted file mode 100644 index 69840f9..0000000 --- a/tests/tweets/identical_urls.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "entities":{ - "hashtags":[ - - ], - "user_mentions":[ - - ], - "symbols":[ - - ], - "urls":[ - { - "display_url":"buff.ly/2sEhrgO", - "expanded_url":"http://buff.ly/2sEhrgO", - "indices":[ - 42, - 65 - ], - "url":"https://t.co/W0uArTMk9N" - }, - { - "display_url":"buff.ly/2sEhrgO", - "expanded_url":"http://buff.ly/2sEhrgO", - "indices":[ - 101, - 124 - ], - "url":"https://t.co/W0uArTMk9N" - } - ] - }, - "full_text":"Use Cases, Trials and Making 5G a Reality https://t.co/W0uArTMk9N #5G #innovation via @5GWorldSeries https://t.co/W0uArTMk9N" -} diff --git a/tests/tweets/media.json b/tests/tweets/media.json deleted file mode 100644 index 4366794..0000000 --- a/tests/tweets/media.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "contributors":null, - "truncated":false, - "is_quote_status":false, - "in_reply_to_status_id":null, - "id":905105588279013377, - "favorite_count":10, - "full_text":"I made some D3.js charts showing the years covered by books in a series compared to their publishing dates https://t.co/2yUmmn3TOc https://t.co/OwNc6uJklg", - "source":"Twitter Web Client", - "retweeted":false, - "coordinates":null, - "entities":{ - "symbols":[ - - ], - "user_mentions":[ - - ], - "hashtags":[ - - ], - "urls":[ - { - "url":"https://t.co/2yUmmn3TOc", - "indices":[ - 107, - 130 - ], - "expanded_url":"http://www.gyford.com/phil/writing/2017/09/05/book-series-charts.php", - "display_url":"gyford.com/phil/writing/2\u2026" - } - ], - "media":[ - { - "expanded_url":"https://twitter.com/philgyford/status/905105588279013377/photo/1", - "display_url":"pic.twitter.com/OwNc6uJklg", - "url":"https://t.co/OwNc6uJklg", - "media_url_https":"https://pbs.twimg.com/media/DI-UuNlWAAA_cvz.jpg", - "id_str":"905105571765944320", - "sizes":{ - "small":{ - "h":256, - "resize":"fit", - "w":680 - }, - "large":{ - "h":376, - "resize":"fit", - "w":1000 - }, - "medium":{ - "h":376, - "resize":"fit", - "w":1000 - }, - "thumb":{ - "h":150, - "resize":"crop", - "w":150 - } - }, - "indices":[ - 131, - 154 - ], - "type":"photo", - "id":905105571765944320, - "media_url":"http://pbs.twimg.com/media/DI-UuNlWAAA_cvz.jpg" - } - ] - }, - "in_reply_to_screen_name":null, - "in_reply_to_user_id":null, - "display_text_range":[ - 0, - 130 - ], - "retweet_count":1, - "id_str":"905105588279013377", - "favorited":false, - "user":{ - "screen_name":"philgyford", - "name":"Phil Gyford" - }, - "geo":null, - "in_reply_to_user_id_str":null, - "possibly_sensitive":false, - "possibly_sensitive_appealable":false, - "lang":"en", - "created_at":"Tue Sep 05 16:29:22 +0000 2017", - "in_reply_to_status_id_str":null, - "place":null, - "extended_entities":{ - "media":[ - { - "expanded_url":"https://twitter.com/philgyford/status/905105588279013377/photo/1", - "display_url":"pic.twitter.com/OwNc6uJklg", - "url":"https://t.co/OwNc6uJklg", - "media_url_https":"https://pbs.twimg.com/media/DI-UuNlWAAA_cvz.jpg", - "id_str":"905105571765944320", - "sizes":{ - "small":{ - "h":256, - "resize":"fit", - "w":680 - }, - "large":{ - "h":376, - "resize":"fit", - "w":1000 - }, - "medium":{ - "h":376, - "resize":"fit", - "w":1000 - }, - "thumb":{ - "h":150, - "resize":"crop", - "w":150 - } - }, - "indices":[ - 131, - 154 - ], - "type":"photo", - "id":905105571765944320, - "media_url":"http://pbs.twimg.com/media/DI-UuNlWAAA_cvz.jpg" - }, - { - "expanded_url":"https://twitter.com/philgyford/status/905105588279013377/photo/1", - "display_url":"pic.twitter.com/OwNc6uJklg", - "url":"https://t.co/OwNc6uJklg", - "media_url_https":"https://pbs.twimg.com/media/DI-UuQbXUAQ1WlR.jpg", - "id_str":"905105572529393668", - "sizes":{ - "large":{ - "h":399, - "resize":"fit", - "w":1000 - }, - "small":{ - "h":271, - "resize":"fit", - "w":680 - }, - "medium":{ - "h":399, - "resize":"fit", - "w":1000 - }, - "thumb":{ - "h":150, - "resize":"crop", - "w":150 - } - }, - "indices":[ - 131, - 154 - ], - "type":"photo", - "id":905105572529393668, - "media_url":"http://pbs.twimg.com/media/DI-UuQbXUAQ1WlR.jpg" - }, - { - "expanded_url":"https://twitter.com/philgyford/status/905105588279013377/photo/1", - "display_url":"pic.twitter.com/OwNc6uJklg", - "url":"https://t.co/OwNc6uJklg", - "media_url_https":"https://pbs.twimg.com/media/DI-UuTIXcAA-t1_.jpg", - "id_str":"905105573255016448", - "sizes":{ - "small":{ - "h":195, - "resize":"fit", - "w":680 - }, - "large":{ - "h":287, - "resize":"fit", - "w":1000 - }, - "medium":{ - "h":287, - "resize":"fit", - "w":1000 - }, - "thumb":{ - "h":150, - "resize":"crop", - "w":150 - } - }, - "indices":[ - 131, - 154 - ], - "type":"photo", - "id":905105573255016448, - "media_url":"http://pbs.twimg.com/media/DI-UuTIXcAA-t1_.jpg" - } - ] - } -} diff --git a/tests/tweets/quoted.json b/tests/tweets/quoted.json deleted file mode 100644 index c8e372b..0000000 --- a/tests/tweets/quoted.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "contributors":null, - "truncated":false, - "text":"Here\u2019s a quoted tweet. https://t.co/3neKzof0gT", - "is_quote_status":true, - "in_reply_to_status_id":null, - "id":917706313785905157, - "favorite_count":0, - "source":"Twitter Web Client", - "quoted_status_id":917699069916729344, - "retweeted":false, - "coordinates":null, - "quoted_status":{ - "contributors":null, - "truncated":false, - "text":"The quoted tweet text.", - "is_quote_status":false, - "in_reply_to_status_id":null, - "id":917699069916729344, - "favorite_count":1, - "source":"Twitter Web Client", - "retweeted":false, - "coordinates":null, - "entities":{ - "symbols":[ - - ], - "user_mentions":[ - - ], - "hashtags":[ - - ], - "urls":[ - - ] - }, - "in_reply_to_screen_name":null, - "in_reply_to_user_id":null, - "retweet_count":0, - "id_str":"917699069916729344", - "favorited":false, - "user":{ - "screen_name":"philgyford", - "name":"Phil Gyford" - }, - "geo":null, - "in_reply_to_user_id_str":null, - "lang":"ht", - "created_at":"Tue Oct 10 10:31:22 +0000 2017", - "in_reply_to_status_id_str":null, - "place":null - }, - "entities":{ - "symbols":[ - - ], - "user_mentions":[ - - ], - "hashtags":[ - - ], - "urls":[ - { - "url":"https://t.co/3neKzof0gT", - "indices":[ - 23, - 46 - ], - "expanded_url":"https://twitter.com/philgyford/status/917699069916729344", - "display_url":"twitter.com/philgyford/sta\u2026" - } - ] - }, - "in_reply_to_screen_name":null, - "in_reply_to_user_id":null, - "retweet_count":0, - "id_str":"917706313785905157", - "favorited":false, - "user":{ - "screen_name":"philgyfordtest", - "name":"Phil Gyford Test" - }, - "geo":null, - "in_reply_to_user_id_str":null, - "possibly_sensitive":false, - "possibly_sensitive_appealable":false, - "lang":"en", - "created_at":"Tue Oct 10 11:00:10 +0000 2017", - "quoted_status_id_str":"917699069916729344", - "in_reply_to_status_id_str":null, - "place":null -} diff --git a/tests/tweets/reply.json b/tests/tweets/reply.json deleted file mode 100644 index 2a22712..0000000 --- a/tests/tweets/reply.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "display_text_range":[ - 12, - 114 - ], - "in_reply_to_status_id_str":"742374355531923456", - "source":"Twitter Web Client", - "geo":null, - "full_text":"@philgyford Here\u2019s a test tweet that goes on as much as possible and includes an image. Hi to my fans in testland! https://t.co/tzhyk2QWSr", - "extended_entities":{ - "media":[ - - ] - }, - "id_str":"300", - "in_reply_to_status_id":742374355531923456, - "id":300, - "in_reply_to_screen_name":"philgyford", - "retweet_count":0, - "user":{ - - }, - "created_at":"Mon Jun 13 15:48:06 +0000 2016", - "lang":"en", - "favorite_count":0, - "coordinates":null, - "place":null, - "contributors":null, - "in_reply_to_user_id":12552, - "in_reply_to_user_id_str":"12552", - "retweeted":false, - "favorited":false, - "truncated":false, - "entities":{ - "user_mentions":[ - { - "id_str":"12552", - "id":12552, - "screen_name":"philgyford", - "name":"Phil Gyford", - "indices":[ - 0, - 11 - ] - } - ], - "media":[ - - ], - "hashtags":[ - - ], - "symbols":[ - - ], - "urls":[ - - ] - }, - "is_quote_status":false, - "possibly_sensitive":false -} diff --git a/tests/tweets/retweet.json b/tests/tweets/retweet.json deleted file mode 100644 index 046bb64..0000000 --- a/tests/tweets/retweet.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "coordinates":null, - "source":"web", - "in_reply_to_user_id_str":null, - "truncated":false, - "in_reply_to_user_id":null, - "favorite_count":0, - "user":{ - "name":"Phil Gyford Test", - "screen_name":"philgyfordtest" - }, - "favorited":false, - "retweeted_status":{ - "coordinates":null, - "source":"Twitter Web Client", - "in_reply_to_user_id_str":null, - "truncated":false, - "in_reply_to_user_id":null, - "favorite_count":21, - "user":{ - "name":"Samuel Pepys", - "screen_name":"samuelpepys" - }, - "favorited":false, - "id":917459832885653506, - "contributors":null, - "in_reply_to_screen_name":null, - "geo":null, - "in_reply_to_status_id_str":null, - "id_str":"917459832885653506", - "entities":{ - "hashtags":[ - - ], - "symbols":[ - - ], - "user_mentions":[ - - ], - "urls":[ - - ] - }, - "in_reply_to_status_id":null, - "text":"My aunt and uncle in a very ill humour one with another, but I made shift with much ado to keep them from scolding.", - "retweet_count":3, - "place":null, - "lang":"en", - "created_at":"Mon Oct 09 18:40:44 +0000 2017", - "is_quote_status":false, - "retweeted":false - }, - "id":917712989649801216, - "contributors":null, - "in_reply_to_screen_name":null, - "geo":null, - "in_reply_to_status_id_str":null, - "id_str":"917712989649801216", - "entities":{ - "hashtags":[ - - ], - "symbols":[ - - ], - "user_mentions":[ - { - "id_str":"14475268", - "indices":[ - 3, - 15 - ], - "name":"Samuel Pepys", - "id":14475268, - "screen_name":"samuelpepys" - } - ], - "urls":[ - - ] - }, - "in_reply_to_status_id":null, - "text":"RT @samuelpepys: My aunt and uncle in a very ill humour one with another, but I made shift with much ado to keep them from scolding.", - "retweet_count":3, - "place":null, - "lang":"en", - "created_at":"Tue Oct 10 11:26:41 +0000 2017", - "is_quote_status":false, - "retweeted":false -} diff --git a/tests/tweets/symbols.json b/tests/tweets/symbols.json deleted file mode 100644 index 7519a08..0000000 --- a/tests/tweets/symbols.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "text":"Some symbols: $AAPL and $PEP and $ANOTHER and $A.", - "contributors":null, - "geo":null, - "favorited":true, - "in_reply_to_user_id_str":null, - "user":{ - "screen_name":"philgyfordtest", - "name":"Phil Gyford Test" - }, - "in_reply_to_user_id":null, - "retweeted":false, - "coordinates":null, - "place":null, - "in_reply_to_status_id":null, - "lang":"en", - "in_reply_to_status_id_str":null, - "truncated":false, - "retweet_count":0, - "is_quote_status":false, - "id":662694880657989632, - "id_str":"662694880657989632", - "in_reply_to_screen_name":null, - "favorite_count":1, - "entities":{ - "hashtags":[ - - ], - "user_mentions":[ - - ], - "symbols":[ - { - "indices":[ - 14, - 19 - ], - "text":"AAPL" - }, - { - "indices":[ - 24, - 28 - ], - "text":"PEP" - }, - { - "indices":[ - 46, - 48 - ], - "text":"A" - } - ], - "urls":[ - - ] - }, - "created_at":"Fri Nov 06 18:15:46 +0000 2015", - "source":"Twitter Web Client" -} diff --git a/twython/__init__.py b/twython/__init__.py index 7d25ef3..1e57cee 100644 --- a/twython/__init__.py +++ b/twython/__init__.py @@ -19,7 +19,7 @@ Questions, comments? ryan@venodesigns.net """ __author__ = 'Ryan McGrath
%(quote)s' \ + text += '%(quote)s' \ '%(quote_user_name)s' \ '@%(quote_user_screen_name)s' \ '' % \ @@ -701,9 +609,4 @@ class Twython(EndpointsMixin, object): 'quote_user_name': quoted_status['user']['name'], 'quote_user_screen_name': quoted_status['user']['screen_name']} - return '%(prefix)s%(display)s%(suffix)s%(quote)s' % { - 'prefix': '%s' % prefix_text if prefix_text else '', - 'display': display_text, - 'suffix': '%s' % suffix_text if suffix_text else '', - 'quote': quote_text - } + return text diff --git a/twython/compat.py b/twython/compat.py index 7c049b0..c36b326 100644 --- a/twython/compat.py +++ b/twython/compat.py @@ -25,7 +25,7 @@ except ImportError: if is_py2: from urllib import urlencode, quote_plus - from urlparse import parse_qsl, urlsplit + from urlparse import parse_qsl str = unicode basestring = basestring @@ -33,7 +33,7 @@ if is_py2: elif is_py3: - from urllib.parse import urlencode, quote_plus, parse_qsl, urlsplit + from urllib.parse import urlencode, quote_plus, parse_qsl str = str basestring = (str, bytes) diff --git a/twython/endpoints.py b/twython/endpoints.py index e35088d..561ec45 100644 --- a/twython/endpoints.py +++ b/twython/endpoints.py @@ -10,19 +10,16 @@ as a keyword argument. e.g. Twython.retweet(id=12345) -Official documentation for Twitter API endpoints can be found at: -https://developer.twitter.com/en/docs/api-reference-index +This map is organized the order functions are documented at: +https://dev.twitter.com/docs/api/1.1 """ -import json import os import warnings -from io import BytesIO -from time import sleep -#try: - #from StringIO import StringIO -#except ImportError: - #from io import StringIO +try: + from StringIO import StringIO +except ImportError: + from io import StringIO from .advisory import TwythonDeprecationWarning @@ -34,7 +31,7 @@ class EndpointsMixin(object): @screen_name) for the authenticating user. Docs: - https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-mentions_timeline + https://dev.twitter.com/docs/api/1.1/get/statuses/mentions_timeline """ return self.get('statuses/mentions_timeline', params=params) @@ -42,10 +39,9 @@ class EndpointsMixin(object): def get_user_timeline(self, **params): """Returns a collection of the most recent Tweets posted by the user - indicated by the ``screen_name`` or ``user_id`` parameters. + indicated by the screen_name or user_id parameters. - Docs: - https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline + Docs: https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline """ return self.get('statuses/user_timeline', params=params) @@ -55,8 +51,7 @@ class EndpointsMixin(object): """Returns a collection of the most recent Tweets and retweets posted by the authenticating user and the users they follow. - Docs: - https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline + Docs: https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline """ return self.get('statuses/home_timeline', params=params) @@ -66,8 +61,7 @@ class EndpointsMixin(object): """Returns the most recent tweets authored by the authenticating user that have been retweeted by others. - Docs: - https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets_of_me + Docs: https://dev.twitter.com/docs/api/1.1/get/statuses/retweets_of_me """ return self.get('statuses/retweets_of_me', params=params) @@ -77,38 +71,34 @@ class EndpointsMixin(object): def get_retweets(self, **params): """Returns up to 100 of the first retweets of a given tweet. - Docs: - https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-retweet-id + Docs: https://dev.twitter.com/docs/api/1.1/get/statuses/retweets/%3Aid """ return self.get('statuses/retweets/%s' % params.get('id'), params=params) def show_status(self, **params): - """Returns a single Tweet, specified by the ``id`` parameter + """Returns a single Tweet, specified by the id parameter - Docs: - https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-show-id + Docs: https://dev.twitter.com/docs/api/1.1/get/statuses/show/%3Aid """ return self.get('statuses/show/%s' % params.get('id'), params=params) def lookup_status(self, **params): """Returns fully-hydrated tweet objects for up to 100 tweets per - request, as specified by comma-separated values passed to the ``id`` + request, as specified by comma-separated values passed to the id parameter. - Docs: - https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-lookup + Docs: https://dev.twitter.com/docs/api/1.1/get/statuses/lookup """ return self.post('statuses/lookup', params=params) def destroy_status(self, **params): - """Destroys the status specified by the required ``id`` parameter + """Destroys the status specified by the required ID parameter - Docs: - https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-destroy-id + Docs: https://dev.twitter.com/docs/api/1.1/post/statuses/destroy/%3Aid """ return self.post('statuses/destroy/%s' % params.get('id')) @@ -116,17 +106,15 @@ class EndpointsMixin(object): def update_status(self, **params): """Updates the authenticating user's current status, also known as tweeting - Docs: - https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update + Docs: https://dev.twitter.com/docs/api/1.1/post/statuses/update """ return self.post('statuses/update', params=params) def retweet(self, **params): - """Retweets a tweet specified by the ``id`` parameter + """Retweets a tweet specified by the id parameter - Docs: - https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-retweet-id + Docs: https://dev.twitter.com/docs/api/1.1/post/statuses/retweet/%3Aid """ return self.post('statuses/retweet/%s' % params.get('id')) @@ -136,7 +124,7 @@ class EndpointsMixin(object): for upload. In other words, it creates a Tweet with a picture attached. Docs: - https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update_with_media + https://dev.twitter.com/docs/api/1.1/post/statuses/update_with_media """ warnings.warn( @@ -149,32 +137,17 @@ class EndpointsMixin(object): def upload_media(self, **params): """Uploads media file to Twitter servers. The file will be available to be attached to a status for 60 minutes. To attach to a update, pass a list of returned media ids - to the :meth:`update_status` method using the ``media_ids`` param. + to the 'update_status' method using the 'media_ids' param. Docs: - https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-upload - + https://dev.twitter.com/rest/reference/post/media/upload """ - # https://developer.twitter.com/en/docs/media/upload-media/api-reference/get-media-upload-status - if params and params.get('command', '') == 'STATUS': - return self.get('https://upload.twitter.com/1.1/media/upload.json', params=params) - return self.post('https://upload.twitter.com/1.1/media/upload.json', params=params) - def create_metadata(self, **params): - """ Adds metadata to a media element, such as image descriptions for visually impaired. - - Docs: - https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-metadata-create - - """ - params = json.dumps(params) - return self.post("https://upload.twitter.com/1.1/media/metadata/create.json", params=params) - - def upload_video(self, media, media_type, media_category=None, size=None, check_progress=False): + def upload_video(self, media, media_type, size=None): """Uploads video file to Twitter servers in chunks. The file will be available to be attached to a status for 60 minutes. To attach to a update, pass a list of returned media ids - to the :meth:`update_status` method using the ``media_ids`` param. + to the 'update_status' method using the 'media_ids' param. Upload happens in 3 stages: - INIT call with size of media to be uploaded(in bytes). If this is more than 15mb, twitter will return error. @@ -184,8 +157,7 @@ class EndpointsMixin(object): Twitter media upload api expects each chunk to be not more than 5mb. We are sending chunk of 1mb each. Docs: - https://developer.twitter.com/en/docs/media/upload-media/uploading-media/chunked-media-upload - + https://dev.twitter.com/rest/public/uploading-media#chunkedupload """ upload_url = 'https://upload.twitter.com/1.1/media/upload.json' if not size: @@ -197,8 +169,7 @@ class EndpointsMixin(object): params = { 'command': 'INIT', 'media_type': media_type, - 'total_bytes': size, - 'media_category': media_category + 'total_bytes': size } response_init = self.post(upload_url, params=params) media_id = response_init['media_id'] @@ -209,7 +180,7 @@ class EndpointsMixin(object): data = media.read(1*1024*1024) if not data: break - media_chunk = BytesIO() + media_chunk = StringIO() media_chunk.write(data) media_chunk.seek(0) @@ -227,55 +198,22 @@ class EndpointsMixin(object): 'command': 'FINALIZE', 'media_id': media_id } - - response = self.post(upload_url, params=params) - - # Only get the status if explicity asked to - # Default to False - if check_progress: - - # Stage 4: STATUS call if still processing - params = { - 'command': 'STATUS', - 'media_id': media_id - } - - # added code to handle if media_category is NOT set and check_progress=True - # the API will return a NoneType object in this case - try: - processing_state = response.get('processing_info').get('state') - except AttributeError: - return response - - if processing_state: - while (processing_state == 'pending' or processing_state == 'in_progress') : - # get the secs to wait - check_after_secs = response.get('processing_info').get('check_after_secs') - - if check_after_secs: - sleep(check_after_secs) - response = self.get(upload_url, params=params) - # get new state after waiting - processing_state = response.get('processing_info').get('state') - - return response + return self.post(upload_url, params=params) def get_oembed_tweet(self, **params): """Returns information allowing the creation of an embedded representation of a Tweet on third party sites. - Docs: - https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-oembed + Docs: https://dev.twitter.com/docs/api/1.1/get/statuses/oembed """ - return self.get('oembed', params=params) + return self.get('statuses/oembed', params=params) def get_retweeters_ids(self, **params): """Returns a collection of up to 100 user IDs belonging to users who - have retweeted the tweet specified by the ``id`` parameter. + have retweeted the tweet specified by the id parameter. - Docs: - https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweeters-ids + Docs: https://dev.twitter.com/docs/api/1.1/get/statuses/retweeters/ids """ return self.get('statuses/retweeters/ids', params=params) @@ -286,8 +224,7 @@ class EndpointsMixin(object): def search(self, **params): """Returns a collection of relevant Tweets matching a specified query. - Docs: - https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets + Docs: https://dev.twitter.com/docs/api/1.1/get/search/tweets """ return self.get('search/tweets', params=params) @@ -299,50 +236,45 @@ class EndpointsMixin(object): def get_direct_messages(self, **params): """Returns the 20 most recent direct messages sent to the authenticating user. - Docs: - https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/list-events + Docs: https://dev.twitter.com/docs/api/1.1/get/direct_messages """ - return self.get('direct_messages/events/list', params=params) + return self.get('direct_messages', params=params) get_direct_messages.iter_mode = 'id' def get_sent_messages(self, **params): """Returns the 20 most recent direct messages sent by the authenticating user. - Docs: - https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-sent-message + Docs: https://dev.twitter.com/docs/api/1.1/get/direct_messages/sent """ return self.get('direct_messages/sent', params=params) get_sent_messages.iter_mode = 'id' def get_direct_message(self, **params): - """Returns a single direct message, specified by an ``id`` parameter. + """Returns a single direct message, specified by an id parameter. - Docs: - https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-event + Docs: https://dev.twitter.com/docs/api/1.1/get/direct_messages/show """ - return self.get('direct_messages/events/show', params=params) + return self.get('direct_messages/show', params=params) def destroy_direct_message(self, **params): - """Destroys the direct message specified in the required ``id`` parameter + """Destroys the direct message specified in the required id parameter - Docs: - https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message-event + Docs: https://dev.twitter.com/docs/api/1.1/post/direct_messages/destroy """ - return self.delete('direct_messages/events/destroy', params=params) + return self.post('direct_messages/destroy', params=params) def send_direct_message(self, **params): """Sends a new direct message to the specified user from the authenticating user. - Docs: - https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event + Docs: https://dev.twitter.com/docs/api/1.1/post/direct_messages/new """ - return self.post('direct_messages/events/new', params=params, json_encoded=True) + return self.post('direct_messages/new', params=params) # Friends & Followers def get_user_ids_of_blocked_retweets(self, **params): @@ -350,7 +282,7 @@ class EndpointsMixin(object): user does not want to receive retweets from. Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-no_retweets-ids + https://dev.twitter.com/docs/api/1.1/get/friendships/no_retweets/ids """ return self.get('friendships/no_retweets/ids', params=params) @@ -359,8 +291,7 @@ class EndpointsMixin(object): """Returns a cursored collection of user IDs for every user the specified user is following (otherwise known as their "friends"). - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-ids + Docs: https://dev.twitter.com/docs/api/1.1/get/friends/ids """ return self.get('friends/ids', params=params) @@ -371,8 +302,7 @@ class EndpointsMixin(object): """Returns a cursored collection of user IDs for every user following the specified user. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids + Docs: https://dev.twitter.com/docs/api/1.1/get/followers/ids """ return self.get('followers/ids', params=params) @@ -381,10 +311,9 @@ class EndpointsMixin(object): def lookup_friendships(self, **params): """Returns the relationships of the authenticating user to the - comma-separated list of up to 100 ``screen_names`` or ``user_ids`` provided. + comma-separated list of up to 100 screen_names or user_ids provided. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-lookup + Docs: https://dev.twitter.com/docs/api/1.1/get/friendships/lookup """ return self.get('friendships/lookup', params=params) @@ -393,8 +322,7 @@ class EndpointsMixin(object): """Returns a collection of numeric IDs for every user who has a pending request to follow the authenticating user. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-incoming + Docs: https://dev.twitter.com/docs/api/1.1/get/friendships/incoming """ return self.get('friendships/incoming', params=params) @@ -405,8 +333,7 @@ class EndpointsMixin(object): """Returns a collection of numeric IDs for every protected user for whom the authenticating user has a pending follow request. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-outgoing + Docs: https://dev.twitter.com/docs/api/1.1/get/friendships/outgoing """ return self.get('friendships/outgoing', params=params) @@ -415,20 +342,18 @@ class EndpointsMixin(object): def create_friendship(self, **params): """Allows the authenticating users to follow the user specified - in the ``id`` parameter. + in the ID parameter. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-create + Docs: https://dev.twitter.com/docs/api/1.1/post/friendships/create """ return self.post('friendships/create', params=params) def destroy_friendship(self, **params): """Allows the authenticating user to unfollow the user specified - in the ``id`` parameter. + in the ID parameter. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy + Docs: https://dev.twitter.com/docs/api/1.1/post/friendships/destroy """ return self.post('friendships/destroy', params=params) @@ -437,8 +362,7 @@ class EndpointsMixin(object): """Allows one to enable or disable retweets and device notifications from the specified user. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-update + Docs: https://dev.twitter.com/docs/api/1.1/post/friendships/update """ return self.post('friendships/update', params=params) @@ -447,8 +371,7 @@ class EndpointsMixin(object): """Returns detailed information about the relationship between two arbitrary users. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-show + Docs: https://dev.twitter.com/docs/api/1.1/get/friendships/show """ return self.get('friendships/show', params=params) @@ -457,8 +380,7 @@ class EndpointsMixin(object): """Returns a cursored collection of user objects for every user the specified user is following (otherwise known as their "friends"). - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-list + Docs: https://dev.twitter.com/docs/api/1.1/get/friends/list """ return self.get('friends/list', params=params) @@ -469,8 +391,7 @@ class EndpointsMixin(object): """Returns a cursored collection of user objects for users following the specified user. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-list + Docs: https://dev.twitter.com/docs/api/1.1/get/followers/list """ return self.get('followers/list', params=params) @@ -482,8 +403,7 @@ class EndpointsMixin(object): """Returns settings (including current trend, geo and sleep time information) for the authenticating user. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-settings + Docs: https://dev.twitter.com/docs/api/1.1/get/account/settings """ return self.get('account/settings', params=params) @@ -494,7 +414,7 @@ class EndpointsMixin(object): code and an error message if not. Docs: - https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials + https://dev.twitter.com/docs/api/1.1/get/account/verify_credentials """ return self.get('account/verify_credentials', params=params) @@ -502,8 +422,7 @@ class EndpointsMixin(object): def update_account_settings(self, **params): """Updates the authenticating user's settings. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-settings + Docs: https://dev.twitter.com/docs/api/1.1/post/account/settings """ return self.post('account/settings', params=params) @@ -521,8 +440,7 @@ class EndpointsMixin(object): """Sets values that users are able to set under the "Account" tab of their settings page. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile + Docs: https://dev.twitter.com/docs/api/1.1/post/account/update_profile """ return self.post('account/update_profile', params=params) @@ -531,35 +449,26 @@ class EndpointsMixin(object): """Updates the authenticating user's profile background image. Docs: - https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_background_image + https://dev.twitter.com/docs/api/1.1/post/account/update_profile_background_image """ return self.post('account/update_profile_banner', params=params) - def update_profile_colors(self, **params): # pragma: no cover + def update_profile_colors(self, **params): """Sets one or more hex values that control the color scheme of the authenticating user's profile page on twitter.com. - This method is deprecated, replaced by the ``profile_link_color`` - parameter to :meth:`update_profile`. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile + https://dev.twitter.com/docs/api/1.1/post/account/update_profile_colors """ - warnings.warn( - 'This method is deprecated. You should use the' - ' profile_link_color parameter in Twython.update_profile instead.', - TwythonDeprecationWarning, - stacklevel=2 - ) return self.post('account/update_profile_colors', params=params) def update_profile_image(self, **params): # pragma: no cover """Updates the authenticating user's profile image. Docs: - https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image + https://dev.twitter.com/docs/api/1.1/post/account/update_profile_image """ return self.post('account/update_profile_image', params=params) @@ -568,8 +477,7 @@ class EndpointsMixin(object): """Returns a collection of user objects that the authenticating user is blocking. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-list + Docs: https://dev.twitter.com/docs/api/1.1/get/blocks/list """ return self.get('blocks/list', params=params) @@ -579,8 +487,7 @@ class EndpointsMixin(object): def list_block_ids(self, **params): """Returns an array of numeric user ids the authenticating user is blocking. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-ids + Docs: https://dev.twitter.com/docs/api/1.1/get/blocks/ids """ return self.get('blocks/ids', params=params) @@ -590,39 +497,35 @@ class EndpointsMixin(object): def create_block(self, **params): """Blocks the specified user from following the authenticating user. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-create + Docs: https://dev.twitter.com/docs/api/1.1/post/blocks/create """ return self.post('blocks/create', params=params) def destroy_block(self, **params): - """Un-blocks the user specified in the ``id`` parameter for the + """Un-blocks the user specified in the ID parameter for the authenticating user. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-destroy + Docs: https://dev.twitter.com/docs/api/1.1/post/blocks/destroy """ return self.post('blocks/destroy', params=params) def lookup_user(self, **params): """Returns fully-hydrated user objects for up to 100 users per request, - as specified by comma-separated values passed to the ``user_id`` and/or - ``screen_name`` parameters. + as specified by comma-separated values passed to the user_id and/or + screen_name parameters. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup + Docs: https://dev.twitter.com/docs/api/1.1/get/users/lookup """ return self.get('users/lookup', params=params) def show_user(self, **params): """Returns a variety of information about the user specified by the - required ``user_id`` or ``screen_name`` parameter. + required user_id or screen_name parameter. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-show + Docs: https://dev.twitter.com/docs/api/1.1/get/users/show """ return self.get('users/show', params=params) @@ -631,8 +534,7 @@ class EndpointsMixin(object): """Provides a simple, relevance-based search interface to public user accounts on Twitter. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search + Docs: https://dev.twitter.com/docs/api/1.1/get/users/search """ return self.get('users/search', params=params) @@ -658,7 +560,7 @@ class EndpointsMixin(object): Returns HTTP 200 upon success. Docs: - https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-remove_profile_banner + https://dev.twitter.com/docs/api/1.1/post/account/remove_profile_banner """ return self.post('account/remove_profile_banner', params=params) @@ -667,7 +569,7 @@ class EndpointsMixin(object): """Uploads a profile banner on behalf of the authenticating user. Docs: - https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_banner + https://dev.twitter.com/docs/api/1.1/post/account/update_profile_banner """ return self.post('account/update_profile_background_image', @@ -677,8 +579,7 @@ class EndpointsMixin(object): """Returns a map of the available size variations of the specified user's profile banner. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-users-profile_banner + Docs: https://dev.twitter.com/docs/api/1.1/get/users/profile_banner """ return self.get('users/profile_banner', params=params) @@ -687,8 +588,7 @@ class EndpointsMixin(object): """Returns a collection of user objects that the authenticating user is muting. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-list + Docs: https://dev.twitter.com/docs/api/1.1/get/mutes/users/list """ return self.get('mutes/users/list', params=params) @@ -699,8 +599,7 @@ class EndpointsMixin(object): """Returns an array of numeric user ids the authenticating user is muting. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-ids + Docs: https://dev.twitter.com/docs/api/1.1/get/mutes/users/ids """ return self.get('mutes/users/ids', params=params) @@ -711,18 +610,16 @@ class EndpointsMixin(object): """Mutes the specified user, preventing their tweets appearing in the authenticating user's timeline. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-create + Docs: https://dev.twitter.com/docs/api/1.1/post/mutes/users/create """ return self.post('mutes/users/create', params=params) def destroy_mute(self, **params): - """Un-mutes the user specified in the user or ``id`` parameter for + """Un-mutes the user specified in the user or ID parameter for the authenticating user. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-destroy + Docs: https://dev.twitter.com/docs/api/1.1/post/mutes/users/destroy """ return self.post('mutes/users/destroy', params=params) @@ -732,7 +629,7 @@ class EndpointsMixin(object): """Access the users in a given category of the Twitter suggested user list. Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug + https://dev.twitter.com/docs/api/1.1/get/users/suggestions/%3Aslug """ return self.get('users/suggestions/%s' % params.get('slug'), @@ -741,8 +638,7 @@ class EndpointsMixin(object): def get_user_suggestions(self, **params): """Access to Twitter's suggested user list. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions + Docs: https://dev.twitter.com/docs/api/1.1/get/users/suggestions """ return self.get('users/suggestions', params=params) @@ -753,7 +649,7 @@ class EndpointsMixin(object): user. Docs: - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug-members + https://dev.twitter.com/docs/api/1.1/get/users/suggestions/%3Aslug/members """ return self.get('users/suggestions/%s/members' % params.get('slug'), @@ -764,29 +660,26 @@ class EndpointsMixin(object): """Returns the 20 most recent Tweets favorited by the authenticating or specified user. - Docs: - https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-favorites-list + Docs: https://dev.twitter.com/docs/api/1.1/get/favorites/list """ return self.get('favorites/list', params=params) get_favorites.iter_mode = 'id' def destroy_favorite(self, **params): - """Un-favorites the status specified in the ``id`` parameter as the + """Un-favorites the status specified in the ID parameter as the authenticating user. - Docs: - https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-destroy + Docs: https://dev.twitter.com/docs/api/1.1/post/favorites/destroy """ return self.post('favorites/destroy', params=params) def create_favorite(self, **params): - """Favorites the status specified in the ``id`` parameter as the + """Favorites the status specified in the ID parameter as the authenticating user. - Docs: - https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-create + Docs: https://dev.twitter.com/docs/api/1.1/post/favorites/create """ return self.post('favorites/create', params=params) @@ -796,8 +689,7 @@ class EndpointsMixin(object): """Returns all lists the authenticating or specified user subscribes to, including their own. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-list + Docs: https://dev.twitter.com/docs/api/1.1/get/lists/list """ return self.get('lists/list', params=params) @@ -805,8 +697,7 @@ class EndpointsMixin(object): def get_list_statuses(self, **params): """Returns a timeline of tweets authored by members of the specified list. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-statuses + Docs: https://dev.twitter.com/docs/api/1.1/get/lists/statuses """ return self.get('lists/statuses', params=params) @@ -815,8 +706,7 @@ class EndpointsMixin(object): def delete_list_member(self, **params): """Removes the specified member from the list. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy + Docs: https://dev.twitter.com/docs/api/1.1/post/lists/members/destroy """ return self.post('lists/members/destroy', params=params) @@ -824,8 +714,7 @@ class EndpointsMixin(object): def get_list_memberships(self, **params): """Returns the lists the specified user has been added to. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-memberships + Docs: https://dev.twitter.com/docs/api/1.1/get/lists/memberships """ return self.get('lists/memberships', params=params) @@ -835,8 +724,7 @@ class EndpointsMixin(object): def get_list_subscribers(self, **params): """Returns the subscribers of the specified list. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers + Docs: https://dev.twitter.com/docs/api/1.1/get/lists/subscribers """ return self.get('lists/subscribers', params=params) @@ -847,7 +735,7 @@ class EndpointsMixin(object): """Subscribes the authenticated user to the specified list. Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-create + https://dev.twitter.com/docs/api/1.1/post/lists/subscribers/create """ return self.post('lists/subscribers/create', params=params) @@ -855,8 +743,7 @@ class EndpointsMixin(object): def is_list_subscriber(self, **params): """Check if the specified user is a subscriber of the specified list. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers-show + Docs: https://dev.twitter.com/docs/api/1.1/get/lists/subscribers/show """ return self.get('lists/subscribers/show', params=params) @@ -865,7 +752,7 @@ class EndpointsMixin(object): """Unsubscribes the authenticated user from the specified list. Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-destroy + https://dev.twitter.com/docs/api/1.1/post/lists/subscribers/destroy """ return self.post('lists/subscribers/destroy', params=params) @@ -875,7 +762,7 @@ class EndpointsMixin(object): list of member ids or screen names. Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create_all + https://dev.twitter.com/docs/api/1.1/post/lists/members/create_all """ return self.post('lists/members/create_all', params=params) @@ -883,8 +770,7 @@ class EndpointsMixin(object): def is_list_member(self, **params): """Check if the specified user is a member of the specified list. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members-show + Docs: https://dev.twitter.com/docs/api/1.1/get/lists/members/show """ return self.get('lists/members/show', params=params) @@ -892,8 +778,7 @@ class EndpointsMixin(object): def get_list_members(self, **params): """Returns the members of the specified list. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members + Docs: https://dev.twitter.com/docs/api/1.1/get/lists/members """ return self.get('lists/members', params=params) @@ -903,8 +788,7 @@ class EndpointsMixin(object): def add_list_member(self, **params): """Add a member to a list. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create + Docs: https://dev.twitter.com/docs/api/1.1/post/lists/members/create """ return self.post('lists/members/create', params=params) @@ -912,8 +796,7 @@ class EndpointsMixin(object): def delete_list(self, **params): """Deletes the specified list. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy + Docs: https://dev.twitter.com/docs/api/1.1/post/lists/destroy """ return self.post('lists/destroy', params=params) @@ -921,8 +804,7 @@ class EndpointsMixin(object): def update_list(self, **params): """Updates the specified list. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-update + Docs: https://dev.twitter.com/docs/api/1.1/post/lists/update """ return self.post('lists/update', params=params) @@ -930,8 +812,7 @@ class EndpointsMixin(object): def create_list(self, **params): """Creates a new list for the authenticated user. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-create + Docs: https://dev.twitter.com/docs/api/1.1/post/lists/create """ return self.post('lists/create', params=params) @@ -939,8 +820,7 @@ class EndpointsMixin(object): def get_specific_list(self, **params): """Returns the specified list. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-show + Docs: https://dev.twitter.com/docs/api/1.1/get/lists/show """ return self.get('lists/show', params=params) @@ -948,8 +828,7 @@ class EndpointsMixin(object): def get_list_subscriptions(self, **params): """Obtain a collection of the lists the specified user is subscribed to. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscriptions + Docs: https://dev.twitter.com/docs/api/1.1/get/lists/subscriptions """ return self.get('lists/subscriptions', params=params) @@ -961,7 +840,7 @@ class EndpointsMixin(object): comma-separated list of member ids or screen names. Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy_all + https://dev.twitter.com/docs/api/1.1/post/lists/members/destroy_all """ return self.post('lists/members/destroy_all', params=params) @@ -969,8 +848,7 @@ class EndpointsMixin(object): def show_owned_lists(self, **params): """Returns the lists owned by the specified Twitter user. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships + Docs: https://dev.twitter.com/docs/api/1.1/get/lists/ownerships """ return self.get('lists/ownerships', params=params) @@ -981,17 +859,16 @@ class EndpointsMixin(object): def get_saved_searches(self, **params): """Returns the authenticated user's saved search queries. - Docs: - https://developer.twitter.com/en/docs/tweets/search/api-reference/get-saved_searches-list + Docs: https://dev.twitter.com/docs/api/1.1/get/saved_searches/list """ return self.get('saved_searches/list', params=params) def show_saved_search(self, **params): - """Retrieve the information for the saved search represented by the given ``id``. + """Retrieve the information for the saved search represented by the given id. Docs: - https://developer.twitter.com/en/docs/tweets/search/api-reference/get-saved_searches-show-id + https://dev.twitter.com/docs/api/1.1/get/saved_searches/show/%3Aid """ return self.get('saved_searches/show/%s' % params.get('id'), @@ -1000,8 +877,7 @@ class EndpointsMixin(object): def create_saved_search(self, **params): """Create a new saved search for the authenticated user. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-create + Docs: https://dev.twitter.com/docs/api/1.1/post/saved_searches/create """ return self.post('saved_searches/create', params=params) @@ -1010,7 +886,7 @@ class EndpointsMixin(object): """Destroys a saved search for the authenticating user. Docs: - https://developer.twitter.com/en/docs/tweets/search/api-reference/post-saved_searches-destroy-id + https://dev.twitter.com/docs/api/1.1/post/saved_searches/destroy/%3Aid """ return self.post('saved_searches/destroy/%s' % params.get('id'), @@ -1020,8 +896,7 @@ class EndpointsMixin(object): def get_geo_info(self, **params): """Returns all the information about a known place. - Docs: - https://developer.twitter.com/en/docs/geo/place-information/api-reference/get-geo-id-place_id + Docs: https://dev.twitter.com/docs/api/1.1/get/geo/id/%3Aplace_id """ return self.get('geo/id/%s' % params.get('place_id'), params=params) @@ -1030,8 +905,7 @@ class EndpointsMixin(object): """Given a latitude and a longitude, searches for up to 20 places that can be used as a place_id when updating a status. - Docs: - https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-reverse_geocode + Docs: https://dev.twitter.com/docs/api/1.1/get/geo/reverse_geocode """ return self.get('geo/reverse_geocode', params=params) @@ -1039,8 +913,7 @@ class EndpointsMixin(object): def search_geo(self, **params): """Search for places that can be attached to a statuses/update. - Docs: - https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-search + Docs: https://dev.twitter.com/docs/api/1.1/get/geo/search """ return self.get('geo/search', params=params) @@ -1066,8 +939,7 @@ class EndpointsMixin(object): """Returns the top 10 trending topics for a specific WOEID, if trending information is available for it. - Docs: - https://developer.twitter.com/en/docs/trends/trends-for-location/api-reference/get-trends-place + Docs: https://dev.twitter.com/docs/api/1.1/get/trends/place """ return self.get('trends/place', params=params) @@ -1075,8 +947,7 @@ class EndpointsMixin(object): def get_available_trends(self, **params): """Returns the locations that Twitter has trending topic information for. - Docs: - https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-available + Docs: https://dev.twitter.com/docs/api/1.1/get/trends/available """ return self.get('trends/available', params=params) @@ -1085,8 +956,7 @@ class EndpointsMixin(object): """Returns the locations that Twitter has trending topic information for, closest to a specified location. - Docs: - https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-closest + Docs: https://dev.twitter.com/docs/api/1.1/get/trends/closest """ return self.get('trends/closest', params=params) @@ -1095,8 +965,7 @@ class EndpointsMixin(object): def report_spam(self, **params): # pragma: no cover """Report the specified user as a spam account to Twitter. - Docs: - https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam + Docs: https://dev.twitter.com/docs/api/1.1/post/users/report_spam """ return self.post('users/report_spam', params=params) @@ -1106,8 +975,7 @@ class EndpointsMixin(object): """Allows a registered application to revoke an issued OAuth 2 Bearer Token by presenting its client credentials. - Docs: - https://developer.twitter.com/en/docs/basics/authentication/api-reference/invalidate_token + Docs: https://dev.twitter.com/docs/api/1.1/post/oauth2/invalidate_token """ return self.post('oauth2/invalidate_token', params=params) @@ -1116,8 +984,7 @@ class EndpointsMixin(object): def get_twitter_configuration(self, **params): """Returns the current configuration used by Twitter - Docs: - https://developer.twitter.com/en/docs/developer-utilities/configuration/api-reference/get-help-configuration + Docs: https://dev.twitter.com/docs/api/1.1/get/help/configuration """ return self.get('help/configuration', params=params) @@ -1126,8 +993,7 @@ class EndpointsMixin(object): """Returns the list of languages supported by Twitter along with their ISO 639-1 code. - Docs: - https://developer.twitter.com/en/docs/developer-utilities/supported-languages/api-reference/get-help-languages + Docs: https://dev.twitter.com/docs/api/1.1/get/help/languages """ return self.get('help/languages', params=params) @@ -1135,8 +1001,7 @@ class EndpointsMixin(object): def get_privacy_policy(self, **params): """Returns Twitter's Privacy Policy - Docs: - https://developer.twitter.com/en/docs/developer-utilities/privacy-policy/api-reference/get-help-privacy + Docs: https://dev.twitter.com/docs/api/1.1/get/help/privacy """ return self.get('help/privacy', params=params) @@ -1144,8 +1009,7 @@ class EndpointsMixin(object): def get_tos(self, **params): """Return the Twitter Terms of Service - Docs: - https://developer.twitter.com/en/docs/developer-utilities/terms-of-service/api-reference/get-help-tos + Docs: https://dev.twitter.com/docs/api/1.1/get/help/tos """ return self.get('help/tos', params=params) @@ -1155,13 +1019,13 @@ class EndpointsMixin(object): specified resource families. Docs: - https://developer.twitter.com/en/docs/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status + https://dev.twitter.com/docs/api/1.1/get/application/rate_limit_status """ return self.get('application/rate_limit_status', params=params) -# from https://developer.twitter.com/en/docs/ads/general/guides/response-codes +# from https://dev.twitter.com/docs/error-codes-responses TWITTER_HTTP_STATUS_CODE = { 200: ('OK', 'Success!'), 304: ('Not Modified', 'There was no new data to return.'), diff --git a/twython/streaming/api.py b/twython/streaming/api.py index 6073abb..47678e4 100644 --- a/twython/streaming/api.py +++ b/twython/streaming/api.py @@ -86,6 +86,8 @@ class TwythonStreamer(object): # Set up type methods StreamTypes = TwythonStreamerTypes(self) self.statuses = StreamTypes.statuses + self.user = StreamTypes.user + self.site = StreamTypes.site self.connected = False @@ -123,7 +125,7 @@ class TwythonStreamer(object): self.on_timeout() else: if response.status_code != 200: - self.on_error(response.status_code, response.content, response.headers) + self.on_error(response.status_code, response.content) if self.retry_count and \ (self.retry_count - retry_counter) > 0: @@ -167,16 +169,16 @@ class TwythonStreamer(object): Returns True if other handlers for this message should be invoked. Feel free to override this to handle your streaming data how you - want it handled. See - https://developer.twitter.com/en/docs/tweets/filter-realtime/guides/streaming-message-types - for messages sent along in stream responses. + want it handled. + See https://dev.twitter.com/docs/streaming-apis/messages for messages + sent along in stream responses. :param data: data recieved from the stream :type data: dict """ return True - def on_error(self, status_code, data, headers=None): # pragma: no cover + def on_error(self, status_code, data): # pragma: no cover """Called when stream returns non-200 status code Feel free to override this to handle your streaming data how you @@ -187,9 +189,6 @@ class TwythonStreamer(object): :param data: Error message sent from stream :type data: dict - - :param headers: Response headers sent from the stream (i.e. Retry-After) - :type headers: dict """ return diff --git a/twython/streaming/types.py b/twython/streaming/types.py index 5042d29..aa6b9ad 100644 --- a/twython/streaming/types.py +++ b/twython/streaming/types.py @@ -20,14 +20,33 @@ class TwythonStreamerTypes(object): self.streamer = streamer self.statuses = TwythonStreamerTypesStatuses(streamer) + def user(self, **params): + """Stream user + + Accepted params found at: + https://dev.twitter.com/docs/api/1.1/get/user + """ + url = 'https://userstream.twitter.com/%s/user.json' \ + % self.streamer.api_version + self.streamer._request(url, params=params) + + def site(self, **params): + """Stream site + + Accepted params found at: + https://dev.twitter.com/docs/api/1.1/get/site + """ + url = 'https://sitestream.twitter.com/%s/site.json' \ + % self.streamer.api_version + self.streamer._request(url, params=params) + class TwythonStreamerTypesStatuses(object): """Class for different statuses endpoints - Available so :meth:`TwythonStreamer.statuses.filter()` is available. - Just a bit cleaner than :meth:`TwythonStreamer.statuses_filter()`, - :meth:`statuses_sample()`, etc. all being single methods in - :class:`TwythonStreamer`. + Available so TwythonStreamer.statuses.filter() is available. + Just a bit cleaner than TwythonStreamer.statuses_filter(), + statuses_sample(), etc. all being single methods in TwythonStreamer """ def __init__(self, streamer): @@ -35,31 +54,31 @@ class TwythonStreamerTypesStatuses(object): self.params = None def filter(self, **params): - r"""Stream statuses/filter + """Stream statuses/filter :param \*\*params: Parameters to send with your stream request Accepted params found at: - https://developer.twitter.com/en/docs/tweets/filter-realtime/api-reference/post-statuses-filter + https://dev.twitter.com/docs/api/1.1/post/statuses/filter """ url = 'https://stream.twitter.com/%s/statuses/filter.json' \ % self.streamer.api_version self.streamer._request(url, 'POST', params=params) def sample(self, **params): - r"""Stream statuses/sample + """Stream statuses/sample :param \*\*params: Parameters to send with your stream request Accepted params found at: - https://developer.twitter.com/en/docs/tweets/sample-realtime/api-reference/get-statuses-sample + https://dev.twitter.com/docs/api/1.1/get/statuses/sample """ url = 'https://stream.twitter.com/%s/statuses/sample.json' \ % self.streamer.api_version self.streamer._request(url, params=params) def firehose(self, **params): - r"""Stream statuses/firehose + """Stream statuses/firehose :param \*\*params: Parameters to send with your stream request @@ -71,12 +90,12 @@ class TwythonStreamerTypesStatuses(object): self.streamer._request(url, params=params) def set_dynamic_filter(self, **params): - r"""Set/update statuses/filter + """Set/update statuses/filter :param \*\*params: Parameters to send with your stream request Accepted params found at: - https://developer.twitter.com/en/docs/tweets/filter-realtime/api-reference/post-statuses-filter + https://dev.twitter.com/docs/api/1.1/post/statuses/filter """ self.params = params @@ -85,4 +104,4 @@ class TwythonStreamerTypesStatuses(object): url = 'https://stream.twitter.com/%s/statuses/filter.json' \ % self.streamer.api_version - self.streamer._request(url, 'POST', params=self.params) + self.streamer._request(url, 'POST', params=self.params)