{"id":43031,"date":"2022-10-24T18:58:00","date_gmt":"2022-10-24T09:58:00","guid":{"rendered":"https:\/\/happy-man.jp\/?p=43031"},"modified":"2022-10-23T20:58:41","modified_gmt":"2022-10-23T11:58:41","slug":"post-43031","status":"publish","type":"post","link":"https:\/\/happy-man.jp\/?p=43031","title":{"rendered":"\u65e5\u306e\u51fa\u6642\u523b\u3092\u304a\u77e5\u3089\u305b\u3059\u308bTweet\u3092\u5410\u304d\u51fa\u3059\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u305f"},"content":{"rendered":"<p>\u65e5\u306e\u51fa\u3084\u65e5\u306e\u5165\u308a\u6642\u523b\u306a\u3069\u65e5\u3005\u523b\u3005\u3068\u5909\u308f\u308b\u6642\u9593\u304c\u3084\u3063\u3066\u304d\u305f\u3089Tweet\u3059\u308b\u3082\u306e\u3092\u4f5c\u3063\u3066\u307f\u305f\u306e\u3067\u5b9f\u88c5\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/happy-man.jp\/?p=43020\">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 &#8211; happyman web<\/a><\/p>\n<p>\u307e\u3042\u4eca\u307e\u3067\u3001\u3042\u308c\u3053\u308c\u3084\u3063\u3066\u307e\u3057\u305f\u306e\u3067\u3001\u6700\u5f8c\u306f\u5408\u4f53\u3059\u3063\u308c\u3070\u5b8c\u6210\u3068\u884c\u304d\u305f\u304b\u3063\u305f\u3068\u3053\u308d\u3067\u3059\u304c\u3001\u5c11\u3057\u3064\u307e\u3065\u3044\u305f\u306e\u3067\u8a18\u9332\u3057\u3066\u304a\u304f\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-python\" data-lang=\"Python\"><code>from my_module import haptweepyapi\r\nfrom pprint import pprint\r\nimport time\r\nfrom datetime import datetime\r\nimport ephem\r\n\r\n#\u65e5\u306e\u51fa\u3068\u65e5\u306e\u5165\u308a\u306e\u5834\u6240\u3092\u8a2d\u5b9a\r\nnagoya = ephem.Observer()\r\nnagoya.lat = '35.1855875'\u00a0\r\nnagoya.lon = '136.8990919'\r\n\r\n#Pyephem \u3067\u4f7f\u7528\u3059\u308b\u6642\u523b\u306f\u3001\u4e16\u754c\u6642\u3067\u8a2d\u5b9a\u3002\r\nnagoya.date = datetime.utcnow()\r\n\r\n#\u592a\u967d\u306e\u65e5\u306e\u51fa\u65e5\u306e\u5165\u308a\u3092\u8a08\u7b97\r\nsun = ephem.Sun()\r\nsunrise = (ephem.localtime(nagoya.next_rising(sun)))\r\nnow = datetime.now()\r\nt2 = (sunrise - now).seconds-5 #\u30bf\u30a4\u30de\u30fc\u306b\u3059\u308b\u3068\u304d\u306f\u76f4\u524d\u306b\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u6570\u79d2\u6e1b\u3089\u3059\u3002\r\nprint(t2)\r\ntime.sleep(t2)\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 = \"\u304a\u306f\u3088\u3046\u304b\u3089\u304a\u3084\u3059\u307f\u307e\u3067\u76ee\u3092\u958b\u3051\u305f\u307e\u307e\u5bdd\u8a00\u3092\u5410\u304f\u4eba\u3092\u6e29\u304b\u304f\u898b\u5b88\u308b\u7a93\u969b\u304a\u3058\u3055\u3093\u306e\u306f\u3074\u305e\u3046\u304c\u3001\u540d\u53e4\u5c4b\u306e\u65e5\u306e\u51fa\u6642\u523b\"+time_str+\"\u3092\u304a\u77e5\u3089\u305b\u3057\u307e\u3059\u3002\"\r\n# \u95a2\u6570\r\n\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\npprint(CreateTweet(message))<\/code><\/pre>\n<\/div>\n<p><span style=\"font-size: 1.6rem;\">\u3053\u3093\u306a\u30bd\u30fc\u30b9\u306b\u3057\u305f\u3089\u306a\u3093\u3068\u304b\u52d5\u304d\u307e\u3057\u305f\u3002<\/span><\/p>\n<p>\u3064\u307e\u305a\u3044\u305f\u306e\u306f\u3001\u30bf\u30a4\u30de\u30fc\u306e\u8d77\u52d5\u3059\u308b\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u6b8b\u308a\u6642\u95930\u79d2\u3067\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u3059\u308b\u3068\u8d77\u52d5\u3057\u306a\u3044\u306e\u3067\u3001\u5c11\u3057\u3060\u3051\u50cd\u304f\u6642\u9593\u3060\u3051\u5dee\u3063\u5f15\u3044\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n<p>\u305d\u3046\u3057\u306a\u3044\u3068\u4ed5\u4e8b\u3092\u3057\u306a\u3044\u3067\u307e\u305f\u660e\u65e5\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4f55\u306e\u5f79\u306b\u3082\u7acb\u3061\u307e\u305b\u3093\u3002<\/p>\n<blockquote class=\"twitter-tweet\" data-width=\"550\" data-dnt=\"true\">\n<p lang=\"ja\" dir=\"ltr\">\u304a\u306f\u3088\u3046\u304b\u3089\u304a\u3084\u3059\u307f\u307e\u3067\u76ee\u3092\u958b\u3051\u305f\u307e\u307e\u5bdd\u8a00\u3092\u5410\u304f\u4eba\u3092\u6e29\u304b\u304f\u898b\u5b88\u308b\u7a93\u969b\u304a\u3058\u3055\u3093\u306e\u306f\u3074\u305e\u3046\u304c\u3001\u540d\u53e4\u5c4b\u306e\u65e5\u306e\u51fa\u6642\u523b06:04\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\/1583927318560456704?ref_src=twsrc%5Etfw\">October 22, 2022<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n<blockquote class=\"twitter-tweet\" data-width=\"550\" data-dnt=\"true\">\n<p lang=\"ja\" dir=\"ltr\">\u65e5\u304c\u66ae\u308c\u308b\u3068\u6b8b\u696d\u4ee3\u3092\u7a3c\u3050\u305f\u3081\u306b\u5143\u6c17\u306b\u306a\u308b\u304a\u3058\u3055\u3093\u3092\u898b\u5b88\u308b\u7a93\u969b\u304a\u3058\u3055\u3093\u304c\u540d\u53e4\u5c4b\u306e\u65e5\u306e\u5165\u308a\u6642\u959317:09\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\/1583732262855528448?ref_src=twsrc%5Etfw\">October 22, 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\u6b21\u306f\u4f55\u3057\u307e\u3057\u3087\u3046\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65e5\u306e\u51fa\u3084\u65e5\u306e\u5165\u308a\u6642\u523b\u306a\u3069\u65e5\u3005\u523b\u3005\u3068\u5909\u308f\u308b\u6642\u9593\u304c\u3084\u3063\u3066\u304d\u305f\u3089Tweet\u3059\u308b\u3082\u306e\u3092\u4f5c\u3063\u3066\u307f\u305f\u306e\u3067\u5b9f\u88c5\u3057\u307e\u3057\u305f\u3002 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 &#8211; happyma [&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-43031","post","type-post","status-publish","format-standard","hentry","category-linux-mint","category-liva","category-python","category-tweepy"],"jetpack_publicize_connections":[],"jetpack-related-posts":[{"id":43020,"url":"https:\/\/happy-man.jp\/?p=43020","url_meta":{"origin":43031,"position":0},"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":42979,"url":"https:\/\/happy-man.jp\/?p=42979","url_meta":{"origin":43031,"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":43031,"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":42966,"url":"https:\/\/happy-man.jp\/?p=42966","url_meta":{"origin":43031,"position":3},"title":"TwitterAPI V2\u306e\u30a2\u30af\u30bb\u30b9\u8a8d\u8a3c\u306e\u90e8\u5206\u3092\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u3057\u3066\u307f\u305f","author":"happyman","date":"2022\u5e7410\u670820\u65e5","format":false,"excerpt":"\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\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_13-38-50_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_13-38-50_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_13-38-50_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_13-38-50_No-00.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":43011,"url":"https:\/\/happy-man.jp\/?p=43011","url_meta":{"origin":43031,"position":4},"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":43105,"url":"https:\/\/happy-man.jp\/?p=43105","url_meta":{"origin":43031,"position":5},"title":"\u306f\u3074\u305e\u3046\u541b\u3067Tweepy\u81ea\u52d5\u30ea\u30d7\u30e9\u30a4\uff08V2\uff09\u3059\u308b\u5185\u5bb9\u3092\u307b\u3093\u306e\u3061\u3087\u3063\u3068\u3060\u3051\u8ce2\u304f\u3057\u3066\u307f\u305f","author":"happyman","date":"2022\u5e7411\u67086\u65e5","format":false,"excerpt":"\u306f\u3074\u305e\u3046\u541b\uff08@haptweepy\uff09\u306b\u4f55\u304b\u8a71\u3057\u304b\u3051\u305f\u3089\u8fd4\u4e8b\u3092\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002 Twitter\u3067\u3001\u81ea\u52d5\u2026","rel":"","context":"Linux mint","block_context":{"text":"Linux mint","link":"https:\/\/happy-man.jp\/?cat=31"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/posts\/43031","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=43031"}],"version-history":[{"count":3,"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/posts\/43031\/revisions"}],"predecessor-version":[{"id":43034,"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/posts\/43031\/revisions\/43034"}],"wp:attachment":[{"href":"https:\/\/happy-man.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=43031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/happy-man.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=43031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/happy-man.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=43031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}