{"id":11981,"date":"2021-08-12T04:51:00","date_gmt":"2021-08-11T20:51:00","guid":{"rendered":"http:\/\/222.73.203.234:9999\/?p=11981"},"modified":"2022-03-28T15:17:21","modified_gmt":"2022-03-28T07:17:21","slug":"%e9%80%9a%e8%bf%87twython%e5%9c%a8raspberry-pi%e4%b8%8a%e5%8f%91%e6%8e%a8%e6%96%87%ef%bc%81%ef%bc%88%e7%ac%ac2%e9%83%a8%e5%88%86%ef%bc%89-2","status":"publish","type":"post","link":"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/raspberry\/11981","title":{"rendered":"\u901a\u8fc7Twython\u5728Raspberry Pi\u4e0a\u53d1\u63a8\u6587\uff01\uff08\u7b2c2\u90e8\u5206\uff09"},"content":{"rendered":"<div class=\"\u201cthe_content_wrapper\u201d\">\u8fd9\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e<a href=\"https:\/\/www.deviceplus.com\/\">DevicePlus.com<\/a>\u82f1\u8bed\u7f51\u7ad9\u7684\u7ffb\u8bd1\u7a3f\u3002<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" class=\"wp-image-8171\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-Tweet-an-image-1.png\" sizes=\"(max-width: 640px) 100vw, 640px\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-Tweet-an-image-1.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-Tweet-an-image-1-300x154.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-Tweet-an-image-1-260x134.png 260w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-Tweet-an-image-1-50x26.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-Tweet-an-image-1-146x75.png 146w\" alt=\"\"><\/figure>\n<p><em>\u539f\u6587\u6700\u521d\u7531<a href=\"https:\/\/deviceplus.jp\/\">deviceplus.jp.<\/a>\u53d1\u5e03\uff0c\u672c\u6587\u4e3a\u82f1\u8bd1\u7248\u3002<\/em><br \/>\n\u6b22\u8fce\u6765\u5230\u901a\u8fc7\u201cTwython\u201d\u5728Raspberry Pi\u4e0a\u53d1\u63a8\u6587\u7684\u7b2c2\u90e8\u5206\u3002<br \/>\n\u548c\u4e0a\u6b21\u4e00\u6837\uff0c\u6211\u4eec\u5c06\u9075\u5faa<a href=\"https:\/\/projects.raspberrypi.org\/en\/projects\/getting-started-with-the-twitter-api\">Raspberry Pi \u5b98\u65b9\u7f51\u7ad9\u6587\u6863<\/a>\u4e2d\u7684\u5185\u5bb9\u6765\u5b8c\u6210\u672c\u9879\u76ee\u3002\u672c\u6b21\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u53d1\u5e03\u5305\u542b\u968f\u673a\u5b57\u7b26\u4e32\u7684\u63a8\u6587\uff0c\u5305\u542b\u56fe\u7247\u7684\u63a8\u6587\u4ee5\u53ca\u4e0e\u5982\u4f55\u5b9e\u73b0\u6d41\u5f0fAPI\u7684\u8fde\u63a5\u3002<br \/>\n\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u4f7f\u75282017\u5e7411\u670829\u65e5\u53d1\u5e03\u7684\u201cRaspbian Stretch with desktop\u201d\u64cd\u4f5c\u7cfb\u7edf\u548c\u201c<a href=\"https:\/\/www.deviceplus.com\/raspberry-pi\/raspberrypi_entry_015\/\">Raspberry Pi2<\/a>Model B\u201d\u3002<br \/>\n\u6709\u5173\u7b2c1\u90e8\u5206\u7684\u5185\u5bb9\uff0c\u8bf7\u67e5\u770b\u2192\u201c\u901a\u8fc7Twython\u5728Raspberry Pi\u4e0a\u53d1\u63a8\u6587\uff01\uff08\u7b2c1\u90e8\u5206\uff09\u201d<\/p>\n<h2><strong>\u53d1\u5e03\u968f\u673a\u63a8\u6587<\/strong><\/h2>\n<p>\u7b2c\u4e03\u9875\u4e2d\u7684\u201c\u968f\u673a\u53d1\u5e03\u63a8\u6587\u4fe1\u606f\u201d\u529f\u80fd\u4f7f\u7528\u4e86Python \u4e2d\u7684\u201crandom\u201d\u6a21\u5757\uff0c\u5e76\u4f7f\u7528\u4e86\u4e00\u4e2a\u7528\u4e8e\u53d1\u5e03\u968f\u673a\u4fe1\u606f\u7684\u7a0b\u5e8f\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-c\" data-lang=\"C\"><code>01  import random\r\n02\r\n03  from twython import Twython\r\n04\r\n05  from auth import (\r\n06\r\n07       consumer_key,\r\n08       consumer_secret,\r\n09       access_token,\r\n10       access_token_secret\r\n11  )\r\n12\r\n13\r\n14  twitter = Twython(\r\n15      consumer_key,\r\n16      consumer_secret,\r\n17      access_token,\r\n18      access_token_secret\r\n19\r\n20  )\r\n21\r\n22\r\n23\r\n24  messages = [\r\n25      \"Hello world\",\r\n26      \"Hi there\",\r\n27      \"What's up?\",\r\n28      \"How's it going?\",\r\n        \"Have you been here before?\",\r\n        \"Get a hair cut!\",\r\n]\r\nmessage = random.choice(messages)\r\ntwitter.update_status(status=message)\r\nprint(\"Tweeted: %s\" % message)\r\n<\/code><\/pre>\n<\/div>\n<p>\u7136\u540e\u6211\u4eec\u5c06\u6587\u4ef6\u4ee5\u201crandom_tweet.py\u201d\u7684\u540d\u79f0\u4fdd\u5b58\u5728\u201c\/home\/pi\u201d\u76ee\u5f55\u4e2d\u3002<br \/>\n\u7b2c3\u884c\u4e2d\u540d\u4e3a\u201cauth\u201d\u7684\u6a21\u5757\u5c31\u662f\u6211\u4eec<a href=\"https:\/\/deviceplus.jp\/hobby\/raspberrypi_entry_066\/\">\u4e0a\u6b21<\/a>\u6240\u521b\u5efa\u7684\u201cauth.py\u201d\u3002\u8be5\u6a21\u5757\u5c06\u201c\u6d88\u8d39\u8005\u5bc6\u94a5\uff08API\u5bc6\u94a5\uff09\u201d\u3001\u201c\u6d88\u8d39\u8005\u79d8\u5bc6\uff08API\u79d8\u5bc6\uff09\u201d\u3001\u201c\u8bbf\u95ee\u4ee4\u724c\u201d\u548c\u201c\u8bbf\u95ee\u4ee4\u724c\u79d8\u5bc6\u201d\u90fd\u653e\u7f6e\u5728\u4e86\u4e00\u8d77\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u628a\u8be5\u6a21\u5757\u653e\u5165\u548c\u201crandom_tweet.py\u201d\u76f8\u540c\u7684\u8def\u5f84\u4e2d\u3002<br \/>\nauth.py<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-c\" data-lang=\"C\"><code>01 consumer_key  = 'ABCDEFGHIJKLKMNOPQRSTUVWXYZ'\r\n02 consumer_secret = '1234567890ABCDEFGHIJKLMNOPQRSTUVXYZ'\r\n03 access_token = 'ZYXWVUTSRQPONMLKJIHFEDCBA'\r\n04 access_token_secret = '0987654321ZYXWVUTSRQPONMLKJIHFEDCBA'\r\n<\/code><\/pre>\n<\/div>\n<p>*\u5c06\u6bcf\u4e2a\u503c\u66ff\u6362\u4e3a\u60a8\u5728<a href=\"https:\/\/apps.twitter.com\/\">Twitter Apps<\/a>\u4e0a\u83b7\u53d6\u7684\u503c\u3002<br \/>\n\u7b2c2-15\u884c\u548c\u6211\u4eec\u5728\u4e0a\u4e00\u7bc7\u6587\u7ae0\u672b\u5c3e\u521b\u5efa\u7684Twitter\u53d1\u5e03\u7a0b\u5e8f\uff08twitter.py\uff09\u76f8\u540c\u3002<br \/>\n\u5c06\u201cimport random\u201d\u6dfb\u52a0\u5230\u7b2c\u4e00\u884c\uff0c\u4ee5\u80fd\u591f\u4f7f\u7528\u968f\u673a\u6570\u3002\u5728\u7b2c17-24\u884c\uff0c\u6211\u4eec\u4ee5\u6570\u7ec4\u7684\u5f62\u5f0f\u5b58\u50a8\u4e86\u516d\u4e2a\u4fe1\u606f\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u5728\u7b2c25\u884c\u4e2d\u9009\u62e9\u5176\u4e2d\u7684\u4e00\u4e2a\u4fe1\u606f\u3002<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" class=\"wp-image-8172\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-random-tweet-1.png\" sizes=\"(max-width: 640px) 100vw, 640px\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-random-tweet-1.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-random-tweet-1-300x117.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-random-tweet-1-260x101.png 260w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-random-tweet-1-50x20.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-random-tweet-1-150x59.png 150w\" alt=\"Send random tweet with Twython \"><figcaption>\u56fe 1<\/figcaption><\/figure>\n<p>\u8f93\u51fa\u5185\u5bb9\u4e3a\u201cHow\u2019s it going?\u201d\u3002\u8fd9\u662f\u5b58\u50a8\u5728\u201cmessages\u201d\u53d8\u91cf\uff08\u6570\u7ec4\uff09\u4e2d\u7684\u7b2c\u56db\u4e2a\u5b57\u7b26\u4e32\u3002<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" class=\"wp-image-8173\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-random-tweet-result-1-1.png\" sizes=\"(max-width: 640px) 100vw, 640px\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-random-tweet-result-1-1.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-random-tweet-result-1-1-300x138.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-random-tweet-result-1-1-260x120.png 260w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-random-tweet-result-1-1-50x23.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-random-tweet-result-1-1-150x69.png 150w\" alt=\"Random tweet with Twython result\"><figcaption>\u56fe 2<\/figcaption><\/figure>\n<p>\u901a\u8fc7\u67e5\u770b\u5b9e\u9645\u53d1\u5e03\u7684\u63a8\u6587\uff0c\u6211\u4eec\u53ef\u4ee5\u786e\u8ba4\u53d1\u5e03\u7684\u5185\u5bb9\u4e3a\u201cHow\u2019s it going?\u201d\u3002\u867d\u7136\u8fd9\u662f\u968f\u673a\u53d1\u5e03\u7684\uff0c\u4f46\u662f\u5982\u679c\u91cd\u590d\u53d1\u5e03\u76f8\u540c\u7684\u5b57\u7b26\u4e32\uff0cTwitter\u5c31\u4f1a\u62a5\u9519\u3002\u51fa\u73b0\u8fd9\u79cd\u60c5\u51b5\u65f6\uff0c\u8bf7\u9694\u4e00\u4f1a\u518d\u53d1\u5e03\u63a8\u6587\uff0c\u5e76\u4e14\u5c3d\u91cf\u4e0d\u8981\u53d1\u5e03\u76f8\u540c\u7684\u5b57\u7b26\u4e32\uff08\u4f8b\u5982\uff0c\u5305\u542b\u76f8\u540c\u7684\u65f6\u95f4\u6216\u5b57\u7b26\u4e32\uff09\u3002\u8fd9\u6837\u4e00\u6765\u5e94\u8be5\u80fd\u591f\u89e3\u51b3\u8be5\u95ee\u9898\u3002<\/p>\n<h2><strong>\u53d1\u5e03\u5305\u542b\u56fe\u7247\u7684\u63a8\u6587\uff01<\/strong><\/h2>\n<p>\u5728\u5f00\u59cb\u4e00\u4e2a\u65b0\u7684\u7a0b\u5e8f\u4e4b\u524d\uff0c\u6211\u4eec\u5148\u51c6\u5907\u597d\u4e00\u5f20\u56fe\u7247\u3002\u8fd9\u6b21\uff0c\u6211\u4eec\u5c06\u9700\u8981\u5bf9\u6587\u6863\u8fdb\u884c\u8c03\u6574\uff0c\u5e76\u5c06\u56fe\u50cf\u6587\u4ef6\u201cimage.png\u201d\u5b58\u50a8\u5230\u201c \/home\/pi\/Downloads\/ \u201d\u76ee\u5f55\u4e2d\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-c\" data-lang=\"C\"><code>from twython import Twython\r\nfrom auth import\r\n(\r\nconsumer_key,\r\nconsumer_secret,\r\naccess_token,\r\naccess_token_secret\r\n)\r\ntwitter = Twython(\r\nconsumer_key,\r\nconsumer_secret,\r\naccess_token,\r\naccess_token_secret\r\n)\r\nmessage = \"Hello world - here's a picture!\"\r\nwith open('\/home\/pi\/Downloads\/raspberry.png', 'rb') as photo: twitter.update_status_with_media(status=message, media=photo)\r\nprint(\"Tweeted: %s\" % message)\r\n<\/code><\/pre>\n<\/div>\n<p>\u7b2c17-18\u884c\u9700\u8981\u5c06\u201cupdate_status\u201d\u6539\u4e3a\u201cupdate_status_with_media\u201d\u3002<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" class=\"wp-image-8174\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-picture-tweet-1.png\" sizes=\"(max-width: 640px) 100vw, 640px\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-picture-tweet-1.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-picture-tweet-1-300x117.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-picture-tweet-1-260x101.png 260w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-picture-tweet-1-50x19.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-picture-tweet-1-150x58.png 150w\" alt=\"Picture tweet with Twython \"><figcaption>\u56fe 3<\/figcaption><\/figure>\n<p>\u4e0a\u56fe\u663e\u793a\u7684\u662f\u8fd0\u884c\u7684\u7ed3\u679c\u3002\u4e0d\u77e5\u9053\u4e3a\u4ec0\u4e48\uff0c\u51fa\u73b0\u4e86\u4e00\u4e9b\u8b66\u544a\u4fe1\u606f\u3002<br \/>\n\u67e5\u770b\u4e00\u4e0b\u8b66\u544a\u5185\u5bb9\uff0c\u5176\u4e2d\u663e\u793a\u5f53\u524d\u4e0d\u5efa\u8bae\u4f7f\u7528\u201cupdate_status_with_media\u201d\u51fd\u6570\u3002<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" class=\"wp-image-8175\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-picture-tweet-result-1.png\" sizes=\"(max-width: 640px) 100vw, 640px\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-picture-tweet-result-1.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-picture-tweet-result-1-300x268.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-picture-tweet-result-1-164x146.png 164w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-picture-tweet-result-1-50x45.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-picture-tweet-result-1-84x75.png 84w\" alt=\"Picture tweet with Twython result \"><figcaption>\u56fe 4<\/figcaption><\/figure>\n<p>\u867d\u7136\u4e0d\u63a8\u8350\uff0c\u4f46\u662f\u770b\u8d77\u6765\u8fd9\u5e76\u4e0d\u5f71\u54cd\u6211\u4eec\u6210\u529f\u53d1\u5e03\u63a8\u6587\u3002\u4e0d\u8fc7\u6211\u4eec\u5bf9\u4e8e\u53d1\u751f\u7684\u72b6\u51b5\u4ea7\u751f\u4e86\u4e00\u4e9b\u5174\u8da3\u3002\u67e5\u770b<a href=\"http:\/\/twython.readthedocs.io\/en\/latest\/usage\/advanced_usage.html?highlight=update_media\">Twython \u5b98\u65b9\u7f51\u7ad9\u624b\u518c<\/a>\u4e4b\u540e\uff0c\u6211\u4eec\u91cd\u65b0\u5199\u4e86\u7a0b\u5e8f\uff01<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-c\" data-lang=\"C\"><code>from twython import Twython\r\nfrom auth import (\r\nconsumer_key,\r\nconsumer_secret,\r\naccess_token,\r\naccess_token_secret\r\ntwitter = Twython(\r\nconsumer_key,\r\nconsumer_secret,\r\naccess_token,\r\naccess_token_secret\r\nmessage = \"Hello world - here's a picture!\"\r\nphoto = open('\/home\/pi\/Downloads\/raspberry.png','rb')\r\nresponse = twitter.upload_media(media=photo)\r\ntwitter.update_status(status=message,\r\nmedia_ids=[response['media_id']]\r\nprint(\"Tweeted: %s\" % message)\r\n<\/code><\/pre>\n<\/div>\n<p>\u67e5\u770b\u624b\u518c\u4e2d<a href=\"http:\/\/twython.readthedocs.io\/en\/latest\/usage\/advanced_usage.html?highlight=update_media#updating-status-with-image\">\u201cUpdating Status with Image\u201d<\/a>\uff08\u4f7f\u7528\u56fe\u7247\u66f4\u65b0\u72b6\u6001\uff09\u90e8\u5206\u540e\uff0c\u6211\u4eec\u66f4\u6539\u4e86\u53d1\u5e03\u63a8\u6587\u7684\u6709\u5173\u5185\u5bb9\u3002<br \/>\n\u6211\u4eec\u5728\u201cupdate_status\u201d\u51fd\u6570\u4e2d\u6dfb\u52a0\u4e86\u56fe\u50cf\u7684\u53c2\u6570\u540e\uff0c\u6210\u529f\u53d1\u5e03\u4e86\u63a8\u6587\uff0c\u5e76\u4e14\u6ca1\u6709\u4ea7\u751f\u4efb\u4f55\u9519\u8bef\uff01\uff08\u63a8\u6587\u4e0e\u56fe4\u76f8\u540c\uff09\u3002<\/p>\n<h2><strong>\u5b9e\u65f6\u63a8\u7279\u64cd\u4f5c\uff01<\/strong><\/h2>\n<p>\u6211\u4eec\u5c06\u8981\u4ecb\u7ecd\u7684\u6700\u540e\u4e00\u9879\u5185\u5bb9\u662f\u7b2c\u4e5d\u9875\u4e2d\u7684\u201c\u6d4b\u8bd5Twython Streamer\u201d\uff01<br \/>\n\u8fd9\u6b21\u6211\u4eec\u8981\u505a\u7684\u662f\u201c\u83b7\u53d6\u201d\u5df2\u7ecf\u53d1\u5e03\u7684\u63a8\u6587\uff0c\u800c\u975e\u201c\u53d1\u5e03\u201d\u63a8\u6587\u3002<br \/>\n\u67e5\u770b\u6587\u6863\u4e2d\u7684\u793a\u4f8b\u540e\uff0c\u6211\u4eec\u8fdb\u884c\u4e86\u4e00\u5b9a\u7a0b\u5ea6\u7684\u4fee\u6539\uff0c\u7a0b\u5e8f\u6e90\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-c\" data-lang=\"C\"><code>from twython import TwythonStreamer\r\nfrom auth import (\r\nconsumer_key,\r\nconsumer_secret,\r\naccess_token,\r\naccess_token_secret\r\nclass MyStreamer(TwythonStreamer):\r\ndef on_success(self, data):\r\nif 'text' in data:\r\nusername = data['user']['screen_name']\r\ntweet = data['text']\r\ndate = data['created_at']\r\nprint(\"%s @%s: %s\" % (date,username, tweet))\r\nprint(\"----------\")\r\nstream = MyStreamer(\r\nconsumer_key,\r\nconsumer_secret,\r\naccess_token,\r\naccess_token_secret\r\nstream.statuses.filter(track='#raspberrypi')\r\n<\/code><\/pre>\n<\/div>\n<p>\u9996\u5148\uff0c\u7b2c1\u884c\u7684\u5bfc\u5165\u6a21\u5757\u90e8\u5206\u53d1\u751f\u4e86\u53d8\u5316\u3002\u4e4b\u524d\uff0c\u6240\u6709\u7684\u793a\u4f8b\u7a0b\u5e8f\u90fd\u5728\u201cTwython\u201d\u7c7b\u4e0b\uff0c\u4f46\u672c\u6b65\u66f4\u6539\u4e3a\u201cTwythonStreamer\u201d\u3002<br \/>\n<a href=\"https:\/\/developer.twitter.com\/en\/docs\/tweets\/filter-realtime\/guides\/streaming-message-types\">Streaming message \uff08\u6d41\u5f0f\u4fe1\u606f\uff09 \u7c7b\u578b \u2014 Twitter \u5f00\u53d1\u8005<\/a><br \/>\n\u201cTwythonStreamer\u201d \u662f\u4e00\u79cd\u7528\u4e8eTwitter\u4e2d\u6d41\u5f0fAPI\u7684\u7c7b\u3002<br \/>\nStreaming message \uff08\u6d41\u5f0f\u4fe1\u606f\uff09\u7c7b\u578b \u2014 Twitter \u5f00\u53d1\u8005<br \/>\n\u5728\u7b2c9-16\u884c\uff0c\u58f0\u660e\u4e86\u540d\u4e3a\u201cMyStreamer\u201d\u7684\u7c7b\u3002\u8fd9\u7528\u4e8e\u5728\u627e\u5230\u63a8\u6587\u65f6\u6307\u5b9a\u64cd\u4f5c\u3002<br \/>\n\u5728\u4e0a\u8ff0\u7a0b\u5e8f\u6e90\u4e2d\uff0c\u9664\u4e86\u63a8\u6587\u7684\u6b63\u6587\u5916\uff0c\u65e5\u671f\u3001\u8d26\u6237\u540d\u79f0\u548c\u5206\u9694\u7ebf\u90fd\u662f\u5728\u8f93\u51fa\u5185\u5bb9\u4e2d\u81ea\u5b9a\u4e49\u7684\u3002<br \/>\n\u5728\u7b2c18-24\u884c\uff0c\u6211\u4e3a\u65b0\u7684\u201cMyStreamer\u201d\u7c7b\u521b\u5efa\u4e86\u4e00\u4e2a\u5b9e\u4f8b\uff0c\u5e76\u5f00\u59cb\u8ffd\u8e2a\u5305\u542b\u201c# raspberrypi\u201d\u7684\u63a8\u6587\u3002<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" class=\"wp-image-8178\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-streamer-1.png\" sizes=\"(max-width: 640px) 100vw, 640px\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-streamer-1.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-streamer-1-300x246.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-streamer-1-178x146.png 178w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-streamer-1-50x41.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2019\/02\/raspberry-pi-twython-2-streamer-1-91x75.png 91w\" alt=\"Tweet real-time with Twython Streamer\"><figcaption>\u56fe 5<\/figcaption><\/figure>\n<p>\u5982\u679c\u60a8\u627e\u5230\u4e86\u63a8\u6587\uff0c\u8f93\u51fa\u5c06\u5982\u4e0a\u6240\u793a\u3002\u5728\u60a8\u505c\u6b62\u8be5\u7a0b\u5e8f\u4e4b\u524d\uff0c\u5b83\u4f1a\u7ee7\u7eed\u83b7\u53d6\u8be5\u7c7b\u578b\u7684\u63a8\u6587\uff08\u8be5\u7a0b\u5e8f\u4f3c\u4e4e\u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff09\u3002<br \/>\n<a href=\"https:\/\/twitter.com\/search?f=tweets&amp;vertical=default&amp;q=%23raspberrypi\">\u5bfb\u627e\u5305\u542b\u201c#raspberrypi\u201d\u7684\u63a8\u6587<\/a><br \/>\n\u63a5\u4e0b\u6765\u8ba9\u6211\u4eec\u8bbf\u95eeTwitter\u5e76\u67e5\u770b\u641c\u7d22\u7ed3\u679c\u3002<br \/>\n\u60a8\u4f1a\u5f97\u5230\u90e8\u5206\u7684\u65f6\u95f4\u65e5\u5fd7\uff0c\u4e0d\u8fc7\u6211\u60f3\u4ece\u4e2d\u53ef\u4ee5\u5927\u81f4\u8bc1\u660e\u8fd9\u4e9b\u4fe1\u606f\u662f\u5b9e\u65f6\u83b7\u53d6\u7684\u3002<\/p>\n<h2><strong>\u603b\u7ed3<\/strong><\/h2>\n<p>\u81f3\u6b64\uff0c\u6211\u4eec\u7ed3\u675f\u4e86\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u201cTwython\u201d\u7684\u7b2c2\u90e8\u5206\u3002\u60a8\u73b0\u5728\u53ef\u4ee5\u66f4\u52a0\u8f7b\u677e\u5730\u5728Twitter\u4e0a\u53d1\u5e03\u548c\u641c\u7d22\u63a8\u6587\u4e86\uff01<br \/>\n\u6211\u8ba4\u4e3a\u57fa\u4e8ePython\u7684\u201cTwython\u201d\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u5e94\u7528\u5230\u4efb\u4f55\u4f7f\u7528\u5143\u5668\u4ef6\u7684\u7535\u5b50\u4ea7\u54c1\u4e2d\u3002\u201cTwython\u201d\u662f\u5c06\u901a\u8fc7API\u8fdb\u884c\u7684\u5185\u90e8\u5904\u7406\u90e8\u5206\u4e0e\u4ee5\u53ef\u89c6\u5316\u5f62\u5f0f\u8f93\u51fa\u7684\u90e8\u5206\u4e4b\u95f4\u76f8\u8fde\u63a5\u7684\u597d\u65b9\u6cd5\u3002\u901a\u8fc7\u53d1\u5e03\u60a8\u6240\u62cd\u6444\u7684\u7167\u7247\uff0c\u6216\u8005\u5bf9\u5305\u542b\u7279\u5b9a\u5173\u952e\u5b57\u7684\u63a8\u6587\u8fdb\u884c\u4e00\u4e9b\u64cd\u4f5c\uff0c\u60a8\u53ef\u4ee5\u7ed3\u5408\u6240\u5b66\u7684\u77e5\u8bc6\u521b\u5efa\u51fa\u5404\u79cd\u5404\u6837\u7684\u4e8b\u7269\uff01<\/p>\n<div class=\"author-box-wrapper\">\n<div class=\"avatar-wrapper\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/micro.wfjydl.com\/deviceplus\/wp-content\/uploads\/2018\/08\/Device-Plus-logo-for-author-info-75x75.png\" alt=\"DevicePlus \u7f16\u8f91\u56e2\u961f\" width=\"64\" height=\"64\"><\/div>\n<div class=\"desc-wrapper\">\n<h5>DevicePlus \u7f16\u8f91\u56e2\u961f<\/h5>\n<div class=\"desc\">\n\u8bbe\u5907\u5347\u7ea7\u7248\u9002\u7528\u4e8e\u6240\u6709\u70ed\u7231\u7535\u5b50\u548c\u673a\u7535\u4e00\u4f53\u5316\u7684\u4eba\u3002\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"\u8fd9\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8eDevicePlus.com\u82f1\u8bed\u7f51\u7ad9\u7684\u7ffb\u8bd1\u7a3f\u3002 \u539f\u6587\u6700\u521d\u7531deviceplus.jp.\u53d1\u5e03\uff0c\u672c\u6587\u4e3a\u82f1\u8bd1\u7248\u3002 \u6b22\u8fce\u6765\u5230\u901a\u8fc7\u201cTwython\u201d\u5728Raspberry Pi\u4e0a\u53d1\u63a8\u6587\u7684\u7b2c2\u90e8\u5206\u3002 \u548c\u4e0a\u6b21\u4e00\u6837\uff0c\u6211\u4eec\u5c06\u9075 [&hellip;]","protected":false},"author":7,"featured_media":16048,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1132],"tags":[],"class_list":["post-11981","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry"],"acf":[],"wps_subtitle":"","_links":{"self":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts\/11981","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/comments?post=11981"}],"version-history":[{"count":1,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts\/11981\/revisions"}],"predecessor-version":[{"id":16049,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts\/11981\/revisions\/16049"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/media\/16048"}],"wp:attachment":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/media?parent=11981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/categories?post=11981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/tags?post=11981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}