{"id":11908,"date":"2022-04-12T09:00:00","date_gmt":"2022-04-12T00:00:00","guid":{"rendered":"https:\/\/www.mizutan.com\/wordpress\/?p=11908"},"modified":"2023-07-08T13:27:15","modified_gmt":"2023-07-08T04:27:15","slug":"post-11908","status":"publish","type":"post","link":"https:\/\/www.mizutan.com\/wordpress\/?p=11908","title":{"rendered":"python\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u60f3\u5b9a\u5916\u306e\u52d5\u304d\u3092\u3059\u308b\u306e\u3067\u30ed\u30b0\u60c5\u5831\u3092\u4ed8\u52a0\u3057\u305f"},"content":{"rendered":"\n<p>\u300c<a href=\"https:\/\/www.mizutan.com\/wordpress\/?p=10119\" data-type=\"post\" data-id=\"10119\" target=\"_blank\" rel=\"noreferrer noopener\">\u53d6\u5f97\u3057\u305f\u4eca\u65e5\u660e\u65e5\u306e\u5929\u6c17\u4e88\u5831\u3092Python\u3067LINE Notify\u306b\u9001\u4ed8<\/a>\u300d\u3067\u6bce\u671d\uff16\u664250\u5206\u306b\u3001\u4eca\u65e5\u3068\u660e\u65e5\u306e\u5929\u6c17\u3092\u304a\u5929\u6c17\u30de\u30fc\u30af\u4ed8\u304d\u3067 LINE Notify \u306b\u8ee2\u9001\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"137\" height=\"320\" src=\"https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/01\/notify_trnki.jpg\" alt=\"\" class=\"wp-image-11910\" srcset=\"https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/01\/notify_trnki.jpg 137w, https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/01\/notify_trnki-128x300.jpg 128w\" sizes=\"auto, (max-width: 137px) 100vw, 137px\" \/><\/figure>\n<\/div>\n\n\n<p>\u6bce\u65e5\u3001\u671d\u8d77\u304d\u305f\u6642\u306b\u3001\u305d\u306e\u65e5\u306e\u5929\u6c17\u3092 LINE Notify \u3067\u78ba\u8a8d\u3057\u3066\u3044\u308b\u3093\u3067\u3059\u304c\u3001\u7a00\u306b\u5929\u6c17\u306e\u60c5\u5831\u304c\u9001\u4ed8\u3055\u308c\u306a\u3044\u65e5\u304c\u3042\u308b\u3093\u3067\u3059\u3002<br><br>\u76f4\u8fd1\u3067\u306f\u30012021\/12\/14 \u304c\u305d\u3046\u3067\u3057\u305f\u300213\u65e5\u306815\u65e5\u306e\u304a\u5929\u6c17\u60c5\u5831\u306f\u9001\u3089\u308c\u3066\u304d\u3066\u3044\u308b\u3093\u3067\u3059\u304c\u3001\u4f55\u6545\u304b\u300012\/14 \u306e\u5929\u6c17\u60c5\u5831\u304c\u9001\u3089\u308c\u3066\u3044\u306a\u3044\u3093\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"301\" height=\"640\" data-id=\"11913\" src=\"https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/03\/notify_01.jpg\" alt=\"\" class=\"wp-image-11913\" srcset=\"https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/03\/notify_01.jpg 301w, https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/03\/notify_01-141x300.jpg 141w\" sizes=\"auto, (max-width: 301px) 100vw, 301px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"307\" height=\"640\" data-id=\"11914\" src=\"https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/03\/notify_02.jpg\" alt=\"\" class=\"wp-image-11914\" srcset=\"https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/03\/notify_02.jpg 307w, https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/03\/notify_02-144x300.jpg 144w\" sizes=\"auto, (max-width: 307px) 100vw, 307px\" \/><figcaption class=\"wp-element-caption\"><strong>12\/14\u304c\u306a\u3044\uff01<\/strong><\/figcaption><\/figure>\n<\/figure>\n\n\n\n<p>\u3053\u306e\u60c5\u5831\u306f Python \u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u4f5c\u6210\u3057\u3001curl \u30b3\u30de\u30f3\u30c9\u3067 Line notify \u306b\u9001\u4ed8\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u4f55\u304b\u60f3\u5b9a\u5916\u306e\u52d5\u304d\u3092\u3057\u305f\u3068\u8003\u3048\u3089\u308c\u307e\u3059\u3002\u4eca\u56de\u306f\u3001\u3053\u306e\u8abf\u67fb\u3092\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<!-- WP QUADS v. 2.0.98  Shortcode Ad -->\n<div class=\"quads-location quads-ad\" id=\"quads-ad\" style=\"float:none;margin:0px 0 0px 0;text-align:center;\">\n\u30b9\u30dd\u30f3\u30b5\u30fc\u30ea\u30f3\u30af\r\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-1169427325398969\"\r\n     crossorigin=\"anonymous\"><\/script>\r\n<!-- www_\u30a4\u30f3\u30c8\u30ed -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-1169427325398969\"\r\n     data-ad-slot=\"1208333098\"\r\n     data-ad-format=\"rectangle\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script><br><\/div>\n\n\n\n\n<h2 class=\"wp-block-heading is-style-vk-heading-double_black\">\u4f55\u304b\u3089\u624b\u3092\u4ed8\u3051\u308b\u304b\uff1f<\/h2>\n\n\n\n<p>\u305d\u3046\u306f\u8a00\u3063\u305f\u3082\u306e\u306e\u73fe\u72b6\u3067\u306f\u5168\u304f\u624b\u639b\u304b\u308a\u304c\u3042\u308a\u307e\u305b\u3093\u3002<br><br>\u5929\u6c17\u60c5\u5831\u304c LINE Notify \u306b\u9001\u4ed8\u3055\u308c\u306a\u3044\u65e5\u306e syslog \u3092\u898b\u3066\u307f\u305f\u3093\u3067\u3059\u304c\u3001\u8d77\u52d5\u6642\u9593\u306b\u30b3\u30de\u30f3\u30c9\u304c\u767a\u884c\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3060\u3051\u306f\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u304c\u3001\u78ba\u8a8d\u3067\u304d\u305f\u306e\u306f\u305d\u308c\u3060\u3051\u3067\u3059\u3002<br><br>\u4f55\u304b\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3044\u306a\u3044\u304b\u898b\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u3053\u308c\u3068\u3044\u3063\u305f\u60c5\u5831\u306f\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<br><br>\u30a8\u30e9\u30fc\u304c\u3042\u308b\u306e\u306a\u3089\u9664\u53bb\u3057\u305f\u3044\u306e\u3067\u3059\u304c\u3001\u60c5\u5831\u304c\u5168\u304f\u306a\u3044\u306e\u3067\u3001\u624b\u306e\u3064\u3051\u3088\u3046\u304c\u3042\u308a\u307e\u305b\u3093\u306d\u3002<br><br>\u8272\u3005\u8003\u3048\u3066\u307f\u305f\u3093\u3067\u3059\u304c\u3001\u307e\u305a\u306f\u3001\u30ed\u30b0\u3092\u53d6\u3063\u3066\u624b\u639b\u304b\u308a\u306b\u3059\u308b\u3053\u3068\u3092\u601d\u3044\u3064\u304d\u307e\u3057\u305f\u3002\u554f\u984c\u304c\u767a\u751f\u3057\u305f\u969b\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u3069\u3053\u307e\u3067\u52d5\u3044\u305f\u304b\u308f\u304b\u308c\u3070\u30c7\u30d0\u30c3\u30b0\u306e\u7aef\u7dd2\u306b\u306a\u308a\u307e\u3059\u3002<br><br>\u30d7\u30ed\u30b0\u30e9\u30e0\u306f python \u3067\u66f8\u3044\u3066\u3044\u307e\u3059\u3002\u30cd\u30c3\u30c8\u4e0a\u3067\u8abf\u3079\u308b\u3068 python \u306e\u30ed\u30b0\u51fa\u529b\u306e\u65b9\u6cd5\u304c\u305f\u304f\u3055\u3093\u51fa\u3066\u3044\u307e\u3059\u3002\u3044\u304f\u3064\u304b\u8aad\u3093\u3067\u307f\u305f\u3093\u3067\u3059\u304c\u3001\u3053\u3046\u3044\u3063\u3061\u3083\u306a\u3093\u3067\u3059\u304c\u30b9\u30ad\u30eb\u306e\u4e4f\u3057\u3044 60\u723a\u306b\u306f\u96e3\u3057\u304f\u3066\u7406\u89e3\u3067\u304d\u307e\u305b\u3093\u3002<br><br>60\u723a\u3068\u3057\u3066\u306f\u3001\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u53d6\u308a\u8fbc\u3093\u3067\u3055\u3063\u3055\u3068\u7d42\u308f\u308a\u306b\u3057\u305f\u3044\u3068\u3044\u3046\u6c17\u6301\u3061\u304c\u3042\u308a\u3001\u6280\u8853\u7684\u306a\u3053\u3068\u306f\u6df1\u304f\u8ffd\u53ca\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u3093\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading is-style-vk-heading-double_black\">\u30ed\u30b0\u60c5\u5831\u7d44\u307f\u8fbc\u307f<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u30ed\u30b0\u8a2d\u5b9a\u30d7\u30ed\u30b0\u30e9\u30e0\u7d44\u307f\u8fbc\u307f<\/h3>\n\n\n\n<p>\u305d\u3053\u3067\u3001\u8272\u3005\u3068\u30ed\u30b0\u306b\u95a2\u3059\u308b\u8a18\u4e8b\u3092\u8aad\u3093\u3060\u3093\u3067\u3059\u304c\u3001\u672b\u5c3e\u306b\u8f09\u305b\u305f\u53c2\u8003\u8a18\u4e8b\u306b\u3042\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d44\u307f\u8fbc\u3093\u3067\u307f\u307e\u3057\u305f\u3002<br><br>\u53c2\u8003\u8a18\u4e8b\u306e\u672b\u5c3e\u306b\u3042\u308b\u300cERROR\u4ee5\u4e0a\u306e\u30ed\u30b0\u3060\u3051\u3092\u51fa\u529b\u3059\u308b\u300d\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u300160\u723a\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u7d44\u307f\u8fbc\u307f\u307e\u3057\u305f\u3002<br><br>\u53c2\u8003\u8a18\u4e8b\u3067\u306f\u300cERROR\u4ee5\u4e0a\u306e\u30ed\u30b0\u3060\u3051\u3092\u51fa\u529b\u3059\u308b\u300d\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u300c\u30a8\u30e9\u30fc\u306e\u539f\u56e0\u3092\u7279\u5b9a\u3057\u305f\u3044\u5834\u5408\u306b\u5fc5\u8981\u306a\u8a73\u7d30\u60c5\u5831\u300d\u304c\u51fa\u529b\u3055\u308c\u308b\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<br><br>\u5373\u3061\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b5\u884c\u76ee\u30689\u884c\u76ee\u306e\u300cERROR\u300d\u3092\u300cDEBUG\u300d\u306b\u3059\u308c\u3070\u3044\u3044\u3067\u3059\u306d\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code># \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u4f5c\u6210\nlogger = logging.getLogger(__name__)\nlogger.setLevel(logging.DEBUG) #DEBUG\u306b\u5909\u66f4\n\n# &quot;example.log&quot;\u3092\u51fa\u529b\u5148\u3068\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u30cf\u30f3\u30c9\u30e9\u4f5c\u6210\nch = logging.FileHandler(filename=&quot;\/home\/pi\/example.log&quot;)\n#DEBUG\u30ec\u30d9\u30eb\u307e\u3067\u898b\u308b\nch.setLevel(logging.DEBUG) #DEBUG\u306b\u5909\u66f4<\/code><\/pre><\/div>\n\n\n\n<p>import\u6587\u306f\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30c8\u30c3\u30d7\u306b\u300125\u884c\u76ee\u4ee5\u964d\u306e\u30af\u30ed\u30fc\u30ba\u5206\u306f\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u6700\u5f8c\u306b\u6301\u3063\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>import  urllib.request\nfrom bs4 import BeautifulSoup\n\nimport logging #\u30ed\u30b0\u306eimport\n\ndef main():\n\u2026\u2026\n#\u30af\u30ed\u30fc\u30ba\n\nlogger.info(&#39;program end&#39;)\n\nlogger.removeHandler(ch)\nch.close()<\/code><\/pre><\/div>\n\n\n\n<p>\u305d\u3057\u3066\u30013\u884c\u76ee\u306e\u300c# \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u4f5c\u6210\u300d\u304b\u308917\u884c\u76ee\u306e\u300c# logger(\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9)\u306b\u30d5\u30a1\u30a4\u30eb\u30cf\u30f3\u30c9\u30e9\u306e\u60c5\u5831\u3092\u4e0e\u3048\u308b\u300d\u307e\u3067\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5148\u982d\u306b\u633f\u5165\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>### Execute\n\n# \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u4f5c\u6210\nlogger = logging.getLogger(__name__)\nlogger.setLevel(logging.DEBUG)\n\n# &quot;example.log&quot;\u3092\u51fa\u529b\u5148\u3068\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u30cf\u30f3\u30c9\u30e9\u4f5c\u6210\nch = logging.FileHandler(filename=&quot;\/home\/pi\/example.log&quot;)\n#DEBUG\u30ec\u30d9\u30eb\u307e\u3067\u898b\u308b\nch.setLevel(logging.DEBUG)\n\n# \u30ed\u30b0\u306e\u8a18\u8ff0\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\nformatter = logging.Formatter(&#39;%(asctime)s - %(name)s - %(levelname)s - %(message)s&#39;)\n\n# \u30d5\u30a1\u30a4\u30eb\u30cf\u30f3\u30c9\u30e9\u306b\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u60c5\u5831\u3092\u4e0e\u3048\u308b\nch.setFormatter(formatter)\n\n# logger(\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9)\u306b\u30d5\u30a1\u30a4\u30eb\u30cf\u30f3\u30c9\u30e9\u306e\u60c5\u5831\u3092\u4e0e\u3048\u308b\nlogger.addHandler(ch)\n\nmark_path =&quot;\/home\/pi\/work\/tenki_mark\/&quot;\n\nLINE_Notify_URL = &quot;https:\/\/notify-api.line.me\/api\/notify&quot;<\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u30ed\u30b0\u51fa\u529b\u306e\u7d44\u307f\u8fbc\u307f<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">\u2460 \u958b\u59cb\u7d42\u4e86\u6642\u306e\u30ed\u30b0<\/h4>\n\n\n\n<p>\u6b21\u306b\u3001\u5fc5\u8981\u306a\u30ed\u30b0\u60c5\u5831\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5404\u6240\u306b\u30bb\u30c3\u30c8\u3057\u3066\u60c5\u5831\u3092\u53d6\u308c\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<br><br>\u305d\u3046\u306f\u3044\u3063\u3066\u3082\u5927\u5c64\u306a\u3053\u3068\u3067\u306f\u306a\u304f\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u958b\u59cb\u53ca\u3073\u7d42\u4e86\u6642\u306b\u300cprogram start\u300d\u3001\u300cprogram end\u300d\u3092\u3001\u305d\u308c\u305e\u308c\u306e\u95a2\u6570\u306e\u5148\u982d\u3068\u6700\u5f8c\u306b\u300c\u95a2\u6570\u540d start\u300d\u3068\u300c\u95a2\u6570\u540d end\u300d\u3092\u633f\u5165\u3057\u305f\u3060\u3051\u3067\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"336\" src=\"https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/02\/log_insert.jpg\" alt=\"\" class=\"wp-image-12119\" srcset=\"https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/02\/log_insert.jpg 640w, https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/02\/log_insert-300x158.jpg 300w, https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/02\/log_insert-375x197.jpg 375w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<h4 class=\"wp-block-heading\">\u2461 url\u8aad\u307f\u8fbc\u307f\u6642\u306e\u30ed\u30b0<\/h4>\n\n\n\n<p>\u3042\u3068\u306f\u3001url\u8aad\u307f\u8fbc\u307f\u6642\u306e\u300cres.read\u300d\u3068 title\u540d\u306e\u8868\u793a\uff08\u4e0b\u8a18#\u30ed\u30b0\u8ffd\u52a0\u3092\u53c2\u7167\uff09\u3092\u884c\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>def Parser(rssurl):\n\n   logger.info(&#39;Parser start&#39;)\n\n   with urllib.request.urlopen(rssurl) as res:\n      xml = res.read()\n      logger.info(&#39;res.read&#39;) #\u30ed\u30b0\u8ffd\u52a0\n      soup = BeautifulSoup(xml, &quot;html.parser&quot;)\n      for item in soup.find_all(&quot;item&quot;):\n         title = item.find(&quot;title&quot;).string\n         description = item.find(&quot;description&quot;).string\n         logger.info(&#39;**item title=%s&#39;,title) #\u30ed\u30b0\u8ffd\u52a0\n         if title.find(&quot;[ PR ]&quot;) == -1:\n            tenki.append(title)\n            detail.append(description)\n\n   logger.info(&#39;Parser end&#39;)<\/code><\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">\u2462 curl\u30b3\u30de\u30f3\u30c9\u5185\u5bb9<\/h4>\n\n\n\n<p>\u6700\u5f8c\u306b\u3001\u51fa\u529b\u3057\u3066\u3044\u308b curl\u30b3\u30de\u30f3\u30c9\u306e\u5185\u5bb9\u3092\u30ed\u30b0\u3068\u3057\u3066\u51fa\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code> # curl comand\n   cmd = &#39;curl -X POST %s -H &quot;%s %s&quot; -F &quot;message=%s&quot; -F &quot;imageFile=@%s&quot;&#39; % (LINE_Notify_URL , H_txt , taken , message , files)\n\n   print(cmd)\n   logger.info(&#39;@@cmd--&gt;%s&#39;,cmd)\n # \u30b3\u30de\u30f3\u30c9\u767a\u884c\n   os.system(cmd)\n\n   logger.info(&#39;curl comand out&#39;)\n   logger.info(&#39;ck_Weather end&#39;)<\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u51fa\u529b\u3055\u308c\u305f\u30ed\u30b0<\/h3>\n\n\n\n<p>\u30ed\u30b0\u3092\u8ffd\u52a0\u3057\u305f\u5f8c\u3001\u8a66\u3057\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br><br>\u305d\u306e\u7d50\u679c\u53d6\u5f97\u3067\u304d\u305f\u30ed\u30b0\u306f\u6b21\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>2022-02-17 08:24:38,718 - __main__ - INFO - program start\n2022-02-17 08:24:38,719 - __main__ - INFO - main start\n2022-02-17 08:24:38,719 - __main__ - INFO - Parser start\n2022-02-17 08:24:39,549 - __main__ - INFO - res.read\n2022-02-17 08:24:39,572 - __main__ - INFO - **item title=\u3010 17\u65e5\uff08\u6728\uff09 \u6771\u90e8\uff08\u6a2a \u6d5c\uff09 \u3011 \u6674\u6642\u3005\u66c7 - 9\u2103\/2\u2103 - Yahoo!\u5929\u6c17\u30fb\u707d\u5bb3\n2022-02-17 08:24:39,573 - __main__ - INFO - **item title=\u3010 18\u65e5\uff08\u91d1\uff09 \u6771\u90e8\uff08\u6a2a \u6d5c\uff09 \u3011 \u6674\u308c - 11\u2103\/2\u2103 - Yahoo!\u5929\u6c17\u30fb\u707d\u5bb3\n2022-02-17 08:24:39,574 - __main__ - INFO - **item title=\u3010 19\u65e5\uff08\u571f\uff09 \u6771\u90e8\uff08\u6a2a \u6d5c\uff09 \u3011 \u66c7\u306e\u3061\u96e8 - 12\u2103\/3\u2103 - Yahoo!\u5929\u6c17\u30fb\u707d\u5bb3\n2022-02-17 08:24:39,575 - __main__ - INFO - **item title=\u3010 20\u65e5\uff08\u65e5\uff09 \u6771\u90e8\uff08\u6a2a \u6d5c\uff09 \u3011 \u66c7\u4e00\u6642\u96e8 - 13\u2103\/3\u2103 - Yahoo!\u5929\u6c17\u30fb\u707d\u5bb3\n2022-02-17 08:24:39,576 - __main__ - INFO - **item title=\u3010 21\u65e5\uff08\u6708\uff09 \u6771\u90e8\uff08\u6a2a \u6d5c\uff09 \u3011 \u6674\u6642\u3005\u66c7 - 10\u2103\/2\u2103 - Yahoo!\u5929\u6c17\u30fb\u707d\u5bb3\n2022-02-17 08:24:39,577 - __main__ - INFO - **item title=\u3010 22\u65e5\uff08\u706b\uff09 \u6771\u90e8\uff08\u6a2a \u6d5c\uff09 \u3011 \u6674\u6642\u3005\u66c7 - 12\u2103\/1\u2103 - Yahoo!\u5929\u6c17\u30fb\u707d\u5bb3\n2022-02-17 08:24:39,578 - __main__ - INFO - **item title=\u3010 23\u65e5\uff08\u6c34\uff09 \u6771\u90e8\uff08\u6a2a \u6d5c\uff09 \u3011 \u6674\u6642\u3005\u66c7 - 11\u2103\/2\u2103 - Yahoo!\u5929\u6c17\u30fb\u707d\u5bb3\n2022-02-17 08:24:39,579 - __main__ - INFO - **item title=\u3010 24\u65e5\uff08\u6728\uff09 \u6771\u90e8\uff08\u6a2a \u6d5c\uff09 \u3011 \u6674\u6642\u3005\u66c7 - 11\u2103\/2\u2103 - Yahoo!\u5929\u6c17\u30fb\u707d\u5bb3\n2022-02-17 08:24:39,579 - __main__ - INFO - **item title=\u3010 \u6a2a\u6d5c\u30fb\u5ddd\u5d0e \u3011\u6ce8\u610f\u5831 \u304c\u3042\u308a\u307e\u3059 - Yahoo!\u5929\u6c17\u30fb\u707d\u5bb3\n2022-02-17 08:24:39,580 - __main__ - INFO - **item title=\u3010 \u6e58\u5357 \u3011\u6ce8\u610f\u5831\u304c\u3042\u308a \u307e\u3059 - Yahoo!\u5929\u6c17\u30fb\u707d\u5bb3\n2022-02-17 08:24:39,581 - __main__ - INFO - **item title=\u3010 \u4e09\u6d66\u534a\u5cf6 \u3011\u6ce8\u610f\u5831\u304c \u3042\u308a\u307e\u3059 - Yahoo!\u5929\u6c17\u30fb\u707d\u5bb3\n2022-02-17 08:24:39,582 - __main__ - INFO - Parser end\n2022-02-17 08:24:39,582 - __main__ - INFO - ck_Weather start i=0\n2022-02-17 08:24:39,584 - __main__ - INFO - @@cmd--&gt;curl -X POST https:\/\/notify-api.line.me\/api\/notify -H &quot;Authorization: Bearer **************&quot; -F &quot;message=\u3010 17\u65e5\uff08\u6728\uff09 \u6771\u90e8\uff08\u6a2a\u6d5c\uff09 \u3011 \u6674\u6642\u3005\u66c7 - 9\u2103\/2\u2103 - Yahoo!\u5929\u6c17\u30fb\u707d\u5bb3&quot; -F &quot;imageFile=@\/home\/pi\/****\/tenki_mark\/SunToCloud.jpg&quot;\n2022-02-17 08:24:40,514 - __main__ - INFO - curl comand out\n2022-02-17 08:24:40,515 - __main__ - INFO - ck_Weather end\n2022-02-17 08:24:40,516 - __main__ - INFO - ck_Weather start i=1\n2022-02-17 08:24:40,517 - __main__ - INFO - @@cmd--&gt;curl -X POST https:\/\/notify-api.line.me\/api\/notify -H &quot;Authorization: Bearer **************&quot; -F &quot;message=\u3010 18\u65e5\uff08\u91d1\uff09 \u6771\u90e8\uff08\u6a2a\u6d5c\uff09 \u3011 \u6674\u308c - 11\u2103\/2\u2103 - Yahoo!\u5929\u6c17\u30fb\u707d\u5bb3&quot; -F &quot;imageFile=@\/home\/pi\/****\/tenki_mark\/Sun.jpg&quot;\n2022-02-17 08:24:41,876 - __main__ - INFO - curl comand out\n2022-02-17 08:24:41,877 - __main__ - INFO - ck_Weather end\n2022-02-17 08:24:41,877 - __main__ - INFO - main end\n2022-02-17 08:24:41,878 - __main__ - INFO - program end<\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u30ed\u30b0\u304c\u51fa\u529b\u3055\u308c\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3057\u3070\u3089\u304f\u904b\u7528\u3057\u3066\u3001\u300c\u5929\u6c17\u60c5\u5831\u304cLINE Notify\u306b\u9001\u4ed8\u3055\u308c\u306a\u3044\u300d\u4e8b\u8c61\u304c\u767a\u751f\u3057\u305f\u969b\u306b\u30ed\u30b0\u306e\u7d50\u679c\u3092\u78ba\u8a8d\u3057\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<!-- WP QUADS v. 2.0.98  Shortcode Ad -->\n<div class=\"quads-location quads-ad\" id=\"quads-ad\" style=\"float:none;margin:0px 0 0px 0;text-align:center;\">\n\u30b9\u30dd\u30f3\u30b5\u30fc\u30ea\u30f3\u30af\r\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-1169427325398969\"\r\n     crossorigin=\"anonymous\"><\/script>\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block; text-align:center;\"\r\n     data-ad-layout=\"in-article\"\r\n     data-ad-format=\"fluid\"\r\n     data-ad-client=\"ca-pub-1169427325398969\"\r\n     data-ad-slot=\"8169621401\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script><br><\/div>\n\n\n\n\n<h3 class=\"wp-block-heading\">urlopen\u4f8b\u5916\u51e6\u7406\u8ffd\u52a0<\/h3>\n\n\n\n<p>\u305d\u3046\u8a00\u3063\u3066\u3044\u305f\u3089\u3001\u4f55\u3068\u3001\u304a\u5929\u6c17\u60c5\u5831\u304c\u9001\u3089\u308c\u3066\u3053\u306a\u3044\u65e5\u304c\u6765\u307e\u3057\u305f\u3002\u30ed\u30b0\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3001\u6b21\u306e3\u884c\u306e\u307f\u3057\u304b\u51fa\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>2022-03-06 06:50:02,601 - __main__ - INFO - program start\n2022-03-06 06:50:02,602 - __main__ - INFO - main start\n2022-03-06 06:50:02,602 - __main__ - INFO - Parser start<\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u3053\u304b\u3089\u63a8\u6e2c\u3059\u308b\u3068\u3001\u3069\u3046\u3084\u3089 urlopen \u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u6a21\u69d8\u3067\u3059\u3002\u4e0a\u8ff0\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u305d\u306e\u90e8\u5206\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u518d\u63b2\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>## Parser : \u5929\u6c17\u60c5\u5831Web\u30da\u30fc\u30b8\u306eHTML\u30bf\u30b0\u304b\u3089\u5929\u6c17\u60c5\u5831\u3092\u62bd\u51fa\u3057\u3066\u30d1\u30fc\u30b9\u3059\u308b\u30e1\u30bd\u30c3\u30c9 ####################\ndef Parser(rssurl):\n\n   logger.info(&#39;Parser start&#39;)\n\n   with urllib.request.urlopen(rssurl) as res:\n      xml = res.read()\n      logger.info(&#39;res.read&#39;)\n      soup = BeautifulSoup(xml, &quot;html.parser&quot;)\n      for item in soup.find_all(&quot;item&quot;):\n         title = item.find(&quot;title&quot;).string\n         description = item.find(&quot;description&quot;).string\n         logger.info(&#39;**item title=%s&#39;,title)\n         if title.find(&quot;[ PR ]&quot;) == -1:\n            tenki.append(title)\n            detail.append(description)\n\n   logger.info(&#39;Parser end&#39;)\n\n### Execute<\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u3053\u306b\u4f8b\u5916\u51e6\u7406\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<br><br>\u305d\u3057\u3066\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u306f\u3001\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u3092\u30ed\u30b0\u3068\u3057\u3066\u5410\u304d\u51fa\u3057\u3059\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>   with urllib.request.urlopen(rssurl) as res:\n      try:\n          xml = res.read()\n          logger.info(&#39;res.read&#39;)\n          soup = BeautifulSoup(xml, &quot;html.parser&quot;)\n          for item in soup.find_all(&quot;item&quot;):\n             title = item.find(&quot;title&quot;).string\n             description = item.find(&quot;description&quot;).string\n             logger.info(&#39;**item title=%s&#39;,title)\n             if title.find(&quot;[ PR ]&quot;) == -1:\n                tenki.append(title)\n                detail.append(description)\n      except Exception as e:\n             logger.info(&#39;!! error !!=%s&#39;,e)<\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u72b6\u614b\u3067\u540c\u3058\u73fe\u8c61\u306e\u518d\u73fe\u3092\u5f85\u3064\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<!-- WP QUADS v. 2.0.98  Shortcode Ad -->\n<div class=\"quads-location quads-ad\" id=\"quads-ad\" style=\"float:none;margin:0px 0 0px 0;text-align:center;\">\n\u30b9\u30dd\u30f3\u30b5\u30fc\u30ea\u30f3\u30af\r\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-1169427325398969\"\r\n     crossorigin=\"anonymous\"><\/script>\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block; text-align:center;\"\r\n     data-ad-layout=\"in-article\"\r\n     data-ad-format=\"fluid\"\r\n     data-ad-client=\"ca-pub-1169427325398969\"\r\n     data-ad-slot=\"9186857477\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script><\/div>\n\n\n\n\n<h2 class=\"wp-block-heading is-style-vk-heading-double_black\">\u885d\u6483\uff01yahoo!\u5929\u6c17 RSS\u30b5\u30fc\u30d3\u30b9\u64a4\u9000<\/h2>\n\n\n\n<p>4\/1 \u306b\u306a\u3063\u3066\u3001\u3055\u3063\u305d\u304f\u5929\u6c17\u60c5\u5831\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u72b6\u6cc1\u306b\u9665\u308a\u307e\u3057\u305f\u3002\u3057\u304b\u3082\u3001\u4e0a\u8a18\u306e\u4f8b\u5916\u51e6\u7406\u3092\u5165\u308c\u305f\u306b\u3082\u304b\u304b\u308f\u3089\u305a\u3001\u305d\u306e\u5bfe\u5fdc\u304c\u751f\u304b\u3055\u308c\u3066\u3044\u306a\u3044\u3053\u3068\u3082\u308f\u304b\u308a\u307e\u3057\u305f\u3002<br><br>\u3057\u304b\u3082\u30014\/2 , 4\/3 \u3082\u540c\u69d8\u306e\u72b6\u6cc1\u3067\u3059\u3002<br><br>\u305d\u3057\u3066\u5206\u304b\u3063\u305f\u306e\u304c\u3053\u3061\u3089\u3067\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"197\" src=\"https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/04\/yahoo_tenki_rss.jpg\" alt=\"\" class=\"wp-image-12274\" srcset=\"https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/04\/yahoo_tenki_rss.jpg 640w, https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/04\/yahoo_tenki_rss-300x92.jpg 300w, https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2022\/04\/yahoo_tenki_rss-375x115.jpg 375w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"has-pale-pink-background-color has-background has-medium-font-size\">\u4f55\u3068\u3001yahoo!\u5929\u6c17 RSS\u30b5\u30fc\u30d3\u30b9\u64a4\u9000\u306e\u304a\u77e5\u3089\u305b\u3067\u3059\uff01yahoo \u307e\u3067 RSS \u30b5\u30fc\u30d3\u30b9\u3092\u64a4\u9000\u3057\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u3067\u306f\u3001\u5929\u6c17\u306e\u60c5\u5831\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u306e\u3082\u5f53\u305f\u308a\u524d\u3067\u3059\u3002<br><br>\u30e0\u30e0\u30e0\u3001\u3053\u306e\u5148\u3001\u3069\u3046\u5bfe\u5fdc\u3057\u305f\u3089\u3088\u3044\u3067\u3057\u3087\u3046\u304b\u3002\u3057\u3070\u3089\u304f\u3001\u5bfe\u5fdc\u7b56\u3092\u8003\u3048\u305f\u3044\u3068\u601d\u3044\u307e\u3059\uff01<\/p>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background has-medium-font-size\">\u53c2\u8003<br><a rel=\"noreferrer noopener\" href=\"https:\/\/www.learning-nao.com\/?p=735\" target=\"_blank\">\u3010Python\u3011\u30ed\u30b0\u306e\u51fa\u529b\u3057\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5b9f\u884c\u8a18\u9332\u3092\u6b8b\u3059<\/a><\/p>\n\n\n\n<!-- WP QUADS v. 2.0.98  Shortcode Ad -->\n<div class=\"quads-location quads-ad\" id=\"quads-ad\" style=\"float:none;margin:0px 0 0px 0;text-align:center;\">\n\u30b9\u30dd\u30f3\u30b5\u30fc\u30ea\u30f3\u30af\r\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-1169427325398969\"\r\n     crossorigin=\"anonymous\"><\/script>\r\n<!-- www_\u8a18\u4e8b\u4e2d\uff13 -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-1169427325398969\"\r\n     data-ad-slot=\"8208817721\"\r\n     data-ad-format=\"rectangle\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script><br><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>\u300c\u53d6\u5f97\u3057\u305f\u4eca\u65e5\u660e\u65e5\u306e\u5929\u6c17\u4e88\u5831\u3092Python\u3067LINE Notify\u306b\u9001\u4ed8\u300d\u3067\u6bce\u671d\uff16\u664250\u5206\u306b\u3001\u4eca\u65e5\u3068\u660e\u65e5\u306e\u5929\u6c17\u3092\u304a\u5929\u6c17\u30de\u30fc\u30af\u4ed8\u304d\u3067 LINE Notify \u306b\u8ee2\u9001\u3057\u3066\u3044\u307e\u3059\u3002 \u6bce\u65e5\u3001\u671d\u8d77\u304d\u305f\u6642\u306b\u3001\u305d\u306e\u65e5\u306e\u5929\u6c17\u3092 LINE [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":11918,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-11908","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspi-tel"],"_links":{"self":[{"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/11908","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11908"}],"version-history":[{"count":3,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/11908\/revisions"}],"predecessor-version":[{"id":17985,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/11908\/revisions\/17985"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/media\/11918"}],"wp:attachment":[{"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11908"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11908"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11908"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}