{"id":42966,"date":"2022-10-20T18:05:00","date_gmt":"2022-10-20T09:05:00","guid":{"rendered":"https:\/\/happy-man.jp\/?p=42966"},"modified":"2022-10-16T14:09:34","modified_gmt":"2022-10-16T05:09:34","slug":"post-42966","status":"publish","type":"post","link":"https:\/\/happy-man.jp\/?p=42966","title":{"rendered":"TwitterAPI V2\u306e\u30a2\u30af\u30bb\u30b9\u8a8d\u8a3c\u306e\u90e8\u5206\u3092\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u3057\u3066\u307f\u305f"},"content":{"rendered":"<p>\u306a\u3093\u304b\u8abf\u5b50\u3088\u304fLIVA\u541b\u304cTwitterbot\u306b\u306a\u308a\u3064\u3064\u3042\u308b\u306e\u3067\u3059\u304c\u3001Twitter\u306e\u8a8d\u8a3c\u306e\u90e8\u5206\u304c\u90aa\u9b54\u304f\u3055\u304f\u306a\u3063\u3066\u304d\u305f\u306e\u3067\u3001\u3053\u3053\u3092\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/happy-man.jp\/?p=42959\">LIVA\u541b\uff08LINUX MINT\uff09\u304b\u3089Python+tweepy+cron\u3067\u6642\u5831\u3092\u304a\u77e5\u3089\u305b\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f &#8211; happyman web<\/a><\/p>\n<p><span style=\"font-size: 12pt;\"><strong>1.\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u6982\u8981<\/strong><\/span><\/p>\n<p>\u95a2\u6570\u3068\u3057\u3066\u826f\u304f\u4f7f\u3046\u3082\u306e\u306f\u3001\u305d\u306e\u90e8\u5206\u3060\u3051\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u3057\u305f\u3089\u826f\u3044\u3089\u3057\u3044\u3002<\/p>\n<p>\u300cmy_module\u300d\u307f\u305f\u3044\u306a\u30b5\u30d6\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u3063\u3066\u3001\u4e2d\u8eab\u306e\u5165\u3063\u3066\u3044\u306a\u3044\u300c__init__.py\u300d\u3068\u8a00\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u7a81\u3063\u8fbc\u3093\u3067\u3084\u308b\u3068\u3001\u305d\u3053\u306b\u5165\u3063\u3066\u3044\u308b\u300c.py\uff63\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u3057\u3066\u8aad\u307f\u51fa\u3057\u3066\u304f\u308c\u308b\u3002<\/p>\n<p><a href=\"https:\/\/qiita.com\/ren094275\/items\/5d42f7c6be8c5d3cd014\">python\u3067\u81ea\u4f5c\u95a2\u6570\u3092\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u30fb\u30d1\u30c3\u30b1\u30fc\u30b8\u5316 &#8211; Qiita<\/a><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-python\" data-lang=\"Python\"><code> #\u81ea\u4f5c\u95a2\u6570\u306e\u30a4\u30f3\u30dd\u30fc\u30c8\r\nfrom \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d import \u30e2\u30b8\u30e5\u30fc\u30eb\u540d<\/code><\/pre>\n<\/div>\n<p>\u3068\u3059\u308b\u3088\u3046\u3060\u3002<\/p>\n<p><span style=\"font-size: 12pt;\"><strong>2\uff0eTwitterAPI\u306e\u90e8\u5206\u3092\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u3057\u3066\u307f\u308b<\/strong><\/span><\/p>\n<p>\u3064\u307e\u308a\u56f3\u793a\u3057\u305f\u90e8\u5206\u3092\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u3057\u307e\u3059\u3002<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" style=\"border: 2px solid black;\" src=\"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_13-38-50_No-00.png?resize=480%2C534&#038;ssl=1\" alt=\"\" width=\"480\" height=\"534\" \/><\/p>\n<p>\u683c\u7d0d\u5148\u3092\u300cmy_module\u300d\u30d5\u30a9\u30eb\u30c0\u306b\u5165\u308c\u3066\u3084\u308b\u3002<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" style=\"border: 2px solid black;\" src=\"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_13-59-51_No-00.png?resize=480%2C94&#038;ssl=1\" alt=\"\" width=\"480\" height=\"94\" \/><\/p>\n<p><span style=\"font-size: 12pt;\"><strong>3\uff0e\u6b8b\u308a\u306e\u90e8\u5206\u3067\u52d5\u304b\u3057\u3066\u307f\u308b\u3002<\/strong><\/span><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-python\" data-lang=\"Python\"><code>from my_module import haptweepyapi<\/code><\/pre>\n<\/div>\n<p>\u3068\u8a00\u3046\u8a18\u8f09\u3092\u3057\u3066\u3084\u308b\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-python\" data-lang=\"Python\"><code>def CreateTweet(message):\r\n\u00a0 \u00a0 tweet = haptweepyapi.ClientInfo().create_tweet(text=message)\r\n\u00a0 \u00a0 return tweet<\/code><\/pre>\n<\/div>\n<p>\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u3057\u3066\u3044\u308b\u95a2\u6570\u3092\u8aad\u307f\u51fa\u3059\u305f\u3081\u306b\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u982d\u306b\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<blockquote class=\"twitter-tweet\" data-width=\"550\" data-dnt=\"true\">\n<p lang=\"ja\" dir=\"ltr\">\u7a93\u969b\u306e\u304a\u3058\u3055\u3093\u306e\u306f\u3074\u305e\u3046\u304c13:33\u6642\u3092\u304a\u77e5\u3089\u305b\u3057\u307e\u3059\u3002<\/p>\n<p>&mdash; \u306f\u3074\u305e\u3046 (@haptweepy) <a href=\"https:\/\/twitter.com\/haptweepy\/status\/1581503495613861889?ref_src=twsrc%5Etfw\">October 16, 2022<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n<p>\u3067\u304d\u307e\u3057\u305f\u3002\u65e5\u672c\u8a9e\u304a\u304b\u3057\u3044\u3051\u3069\u306d\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-python\" data-lang=\"Python\"><code>import tweepy\r\nfrom my_module import haptweepyapi\r\nfrom pprint import pprint\r\nfrom datetime import datetime\r\n\r\n# \u6642\u523b\u3092\u53d6\u5f97\r\ndatetime_dat = datetime.now()\r\ntime_str = datetime_dat.strftime('%H:%M')\r\nprint(time_str)\r\n\r\n# \u2605\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u6307\u5b9a\r\nmessage = \"\u7a93\u969b\u304a\u3058\u3055\u3093\u306e\u306f\u3074\u305e\u3046\u304c\"+time_str+\"\u3092\u304a\u77e5\u3089\u305b\u3057\u307e\u3059\u3002\"\r\n\r\n# \u95a2\u6570\r\ndef CreateTweet(message):\r\n\u00a0 \u00a0 tweet = haptweepyapi.ClientInfo().create_tweet(text=message)\r\n\u00a0 \u00a0 return tweet\r\n\r\n# \u95a2\u6570\u5b9f\u884c\u30fb\u7d50\u679c\u51fa\u529b\r\n\r\npprint(CreateTweet(message))<\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u306a\u3093\u304b\u8abf\u5b50\u3088\u304fLIVA\u541b\u304cTwitterbot\u306b\u306a\u308a\u3064\u3064\u3042\u308b\u306e\u3067\u3059\u304c\u3001Twitter\u306e\u8a8d\u8a3c\u306e\u90e8\u5206\u304c\u90aa\u9b54\u304f\u3055\u304f\u306a\u3063\u3066\u304d\u305f\u306e\u3067\u3001\u3053\u3053\u3092\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002 LIVA\u541b\uff08LINUX MINT\uff09\u304b\u3089Python+twee [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"_lightning_design_setting":[],"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[31,27,141,142],"tags":[],"class_list":["post-42966","post","type-post","status-publish","format-standard","hentry","category-linux-mint","category-liva","category-python","category-tweepy"],"jetpack_publicize_connections":[],"jetpack-related-posts":[{"id":43011,"url":"https:\/\/happy-man.jp\/?p=43011","url_meta":{"origin":42966,"position":0},"title":"Python\u306eSchedule\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3063\u3066Twitter\u306b\u6642\u5831\u3092\u5410\u304d\u51fa\u3057\u3066\u307f\u305f\u3002","author":"happyman","date":"2022\u5e7410\u670822\u65e5","format":false,"excerpt":"Linux\u306b\u306fcron\u304c\u6709\u308b\u3051\u3069\u3082\u3001Windows\u306b\u306fcron\u304c\u306a\u3044\u306e\u3067\u3001Windows\u3067\u5b9a\u6642\u8d77\u52d5\u3055\u2026","rel":"","context":"Linux mint","block_context":{"text":"Linux mint","link":"https:\/\/happy-man.jp\/?cat=31"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/a658ada500911819d41bbaa8bdba9ed0.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/a658ada500911819d41bbaa8bdba9ed0.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/a658ada500911819d41bbaa8bdba9ed0.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":42979,"url":"https:\/\/happy-man.jp\/?p=42979","url_meta":{"origin":42966,"position":1},"title":"LIVA\u541b\uff08LINUX MINT\uff09\u304b\u3089Python+ tweepy+PyEphem\u3067\u660e\u65e5\u306e\u65e5\u306e\u51fa\u3068\u65e5\u306e\u5165\u308a\u6642\u523b\u3092\u304a\u77e5\u3089\u305b\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f","author":"happyman","date":"2022\u5e7410\u670821\u65e5","format":false,"excerpt":"\u6bce\u65e5\u6b63\u6642\u306e\u6642\u5831\u3092\u305f\u3060\u6de1\u3005\u3068\u5410\u304d\u51fa\u3059LIVA\u541b\u306a\u3093\u3067\u3059\u304c\u3001\u306a\u3093\u304b\u3082\u3046\u5c11\u3057\u8ce2\u3044\u3068\u3053\u308d\u898b\u3066\u898b\u305f\u3044\u3002 LIV\u2026","rel":"","context":"Linux mint","block_context":{"text":"Linux mint","link":"https:\/\/happy-man.jp\/?cat=31"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/0bbc0f678f9f167b7a2470c8386fc6a1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/0bbc0f678f9f167b7a2470c8386fc6a1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/0bbc0f678f9f167b7a2470c8386fc6a1.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":42959,"url":"https:\/\/happy-man.jp\/?p=42959","url_meta":{"origin":42966,"position":2},"title":"LIVA\u541b\uff08LINUX MINT\uff09\u304b\u3089Python+tweepy+cron\u3067\u6642\u5831\u3092\u304a\u77e5\u3089\u305b\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f","author":"happyman","date":"2022\u5e7410\u670819\u65e5","format":false,"excerpt":"cron\u3067\u6240\u5b9a\u306e\u6642\u9593\u306b\u30c4\u30a4\u30fc\u30c8\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3089\u6b32\u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u3002 LIVA\u541b\uff08LINUX MIN\u2026","rel":"","context":"Linux mint","block_context":{"text":"Linux mint","link":"https:\/\/happy-man.jp\/?cat=31"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_12-53-46_No-00.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_12-53-46_No-00.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_12-53-46_No-00.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_12-53-46_No-00.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":43113,"url":"https:\/\/happy-man.jp\/?p=43113","url_meta":{"origin":42966,"position":3},"title":"\u6c17\u8c61\u5e81\u306e\u767a\u8868\u3057\u3066\u3044\u308b\u6c17\u8c61\u30c7\u30fc\u30bf\u3092Twitter\u306b\u5410\u304d\u51fa\u3059\u3088\u3046\u306b\u3057\u3066\u307f\u305f\uff08\u6012\u3089\u308c\u306a\u3044\u3088\u3046\u306b\uff1f\uff09","author":"happyman","date":"2022\u5e7411\u67087\u65e5","format":false,"excerpt":"\u4e16\u306e\u4e2d\u3067\u306fWeb\u516c\u958b\u3055\u308c\u3066\u308b\u30c7\u30fc\u30bf\u3092\u68b3\u304d\u53d6\u3063\u3066\u518d\u5229\u7528\u3057\u3066\u3044\u308b\u4e8b\u304c\u591a\u3044\u3089\u3057\u3044\u3002 \u307e\u3042\u96fb\u5b50\u30c7\u30fc\u30bf\u3067\u3059\u304b\u3089\u2026","rel":"","context":"Linux mint","block_context":{"text":"Linux mint","link":"https:\/\/happy-man.jp\/?cat=31"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/11\/SnapCrab_NoName_2022-11-6_10-41-45_No-00.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/11\/SnapCrab_NoName_2022-11-6_10-41-45_No-00.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/11\/SnapCrab_NoName_2022-11-6_10-41-45_No-00.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/11\/SnapCrab_NoName_2022-11-6_10-41-45_No-00.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":43020,"url":"https:\/\/happy-man.jp\/?p=43020","url_meta":{"origin":42966,"position":4},"title":"Python\u3067\u65e5\u306e\u51fa\u6642\u523b\u306a\u3069\u6bce\u65e5\u6642\u9593\u304c\u5909\u308f\u308b\u3082\u306e\u306b\u5bfe\u3059\u308b\u6b8b\u308a\u6642\u9593\u3092\u8a08\u7b97\u3057\u3066\u307f\u308b\u3002","author":"happyman","date":"2022\u5e7410\u670823\u65e5","format":false,"excerpt":"Python\u306eSchedule\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u306f\u3001\u6bce\u65e5\u306e\u6642\u523b\u306e\u6307\u5b9a\u306f\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001\u8a08\u7b97\u3057\u305f\u6642\u9593\u3092Sch\u2026","rel":"","context":"Linux mint","block_context":{"text":"Linux mint","link":"https:\/\/happy-man.jp\/?cat=31"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/aa5729cdcbc19b90c3326e8945147299.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/aa5729cdcbc19b90c3326e8945147299.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/aa5729cdcbc19b90c3326e8945147299.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":42954,"url":"https:\/\/happy-man.jp\/?p=42954","url_meta":{"origin":42966,"position":5},"title":"LIVA\u541b\uff08LINUX MINT\uff09\u304b\u3089Python+tweepy+cron\u3067\u30e9\u30b8\u30aa\u4f53\u64cd\u306e\u6642\u9593\u3092\u304a\u77e5\u3089\u305b\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f","author":"happyman","date":"2022\u5e7410\u670818\u65e5","format":false,"excerpt":"Python+tweppy\u3063\u3066\u5468\u56de\u9045\u308c\u306a\u304c\u3089\u9762\u767d\u3044\u30b8\u30e3\u30de\u30a4\u30ab\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u6687\u3064\u3076\u3057\u306b\u5c11\u3057\u904a\u3093\u3067\u3044\u307e\u3059\u2026","rel":"","context":"Linux mint","block_context":{"text":"Linux mint","link":"https:\/\/happy-man.jp\/?cat=31"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_6-43-37_No-00.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_6-43-37_No-00.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_6-43-37_No-00.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_6-43-37_No-00.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/posts\/42966","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/happy-man.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=42966"}],"version-history":[{"count":3,"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/posts\/42966\/revisions"}],"predecessor-version":[{"id":42968,"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/posts\/42966\/revisions\/42968"}],"wp:attachment":[{"href":"https:\/\/happy-man.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=42966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/happy-man.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=42966"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/happy-man.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=42966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}