{"id":2774,"date":"2023-02-03T02:59:21","date_gmt":"2023-02-02T17:59:21","guid":{"rendered":"https:\/\/okamoto3.com\/?p=2774"},"modified":"2023-03-02T21:44:20","modified_gmt":"2023-03-02T12:44:20","slug":"motioneye-post-data","status":"publish","type":"post","link":"https:\/\/okamoto3.com\/index.php\/2023\/02\/03\/motioneye-post-data\/2774\/","title":{"rendered":"MotionEye, MotionEye .eo post data cannot be of type str!\u3000\u76f4\u3057\u65b9"},"content":{"rendered":"<p>MotionEye\u3067Dropbox\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3088\u3046\u3068\u3057\u305f\u3089\u3053\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u30cf\u30de\u3063\u305f\uff01\u306a\u3093\u3068\u304b\u89e3\u6c7a\u3057\u305f\u306e\u3067\u3001\u3055\u3089\u3059\u3002<\/p><p>MotionEye\u3082MotionEye.eo\u3082\u540c\u3058\u3084\u308a\u65b9\u3067OK!<\/p><h2 class=\"wp-block-heading\">Accessing the upload service failed: POST data should be bytes, an iterable of bytes, or a file object. it cannot be of type str!<\/h2><figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"336\" src=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2023\/02\/img_20230202_1129166395883961849651505.jpg?resize=750%2C336&#038;ssl=1\" alt=\"\" class=\"wp-image-2777\" srcset=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2023\/02\/img_20230202_1129166395883961849651505.jpg?resize=1024%2C459&amp;ssl=1 1024w, https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2023\/02\/img_20230202_1129166395883961849651505.jpg?resize=300%2C134&amp;ssl=1 300w, https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2023\/02\/img_20230202_1129166395883961849651505.jpg?resize=768%2C344&amp;ssl=1 768w, https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2023\/02\/img_20230202_1129166395883961849651505.jpg?resize=600%2C269&amp;ssl=1 600w, https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2023\/02\/img_20230202_1129166395883961849651505.jpg?w=1080&amp;ssl=1 1080w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure><h2 class=\"wp-block-heading\">\u30a8\u30e9\u30fc\uff1aMotionEye\u306f\u6587\u5b57\u5217\u3067Authorization key\u3092\u53d7\u3051\u53d6\u308c\u306a\u3044\u3002<\/h2><p>\u3053\u308c\u306f\u3001\u30ed\u30dc\u30b3\u30f3\u306e\u30ea\u30e2\u30b3\u30f3\u30d7\u30ed\u30b0\u30e9\u30e0\u3092pyhon2\u304b\u3089python3\u306b\u3057\u305f\u3068\u304d\u306b\u51fa\u304f\u308f\u3057\u305f\u3053\u3068\u304c\u3042\u308b\u3002\u3053\u3061\u3089\u3092\u53c2\u8003<\/p><p><a href=\"https:\/\/stackoverflow.com\/questions\/65905655\/requests-different-data-between-python-2-vs-python-3\">python2\u30683\u3067\u306eHTTP POST\/GET\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u9055\u3044<\/a><\/p><h2 class=\"wp-block-heading\">MotionEye\u306e\u5909\u66f4<\/h2><p>google\u5148\u751f\u3068\u308f\u3057\u306e\u30ab\u30f3\u306b\u3088\u308auploadservices.py\u304c\u308f\u308b\u3044\u3093\u3058\u3083\u306d\uff1f\u30ab\u30f3\u8a00\u3046\u3088\u308a\u3001\u305d\u306e\u307e\u307e\u3093\u307e\u306e\u304a\u540d\u524d\u3002<\/p><ul class=\"has-white-color has-black-background-color has-text-color has-background wp-block-list\"><li>sudo find \/ -name &#8216;uploadservices.py&#8217;<\/li><\/ul><p>\u3069\u3053\u3067\u3059\u304b\uff1f\u308f\u3057\u306e\u306f\u3001\u3053\u3053\u306b\u3042\u3063\u305f\u3067\u3002<\/p><p>\/usr\/local\/lib\/python3.9\/dist-packages\/motioneye<\/p><p>\u5909\u66f4\u524d\u306b\u30aa\u30ea\u30b8\u30ca\u30eb\u3092\u30b3\u30d4\u30fc\u3057\u3068\u3053\u3002<\/p><ul class=\"has-white-color has-black-background-color has-text-color has-background wp-block-list\"><li>sudo cp \/usr\/local\/lib\/python3.9\/dist-packages\/motioneye\/uploadservices.py \/usr\/local\/lib\/python3.9\/dist-packages\/motioneye\/uploadservices.py.org<\/li><\/ul><p>\u3053\u308c\u3092\u5909\u66f4\u3002\u308f\u3057\u306fnano\u3068\u8a00\u3046Editor\u3058\u3083\u3002<\/p><ul class=\"has-white-color has-black-background-color has-text-color has-background wp-block-list\"><li>sudo nano \/usr\/local\/lib\/python3.9\/dist-packages\/motioneye\/uploadservices.py<\/li><\/ul><p>\u30af\u30e9\u30b9Dropbox\u3092\u898b\u3064\u3051\u3001\u4ee5\u4e0b\u306e\u5909\u66f4\u3092\u52a0\u3048\u308b\u3002(ctrl+w\u3067Dropbox\u3092\u691c\u7d22)<\/p><p class=\"has-white-color has-black-background-color has-text-color has-background\">class Dropbox(UploadService):<br \/>    NAME = &#8216;dropbox&#8217;<br \/><br \/>    AUTH_URL = &#8216;https:\/\/www.dropbox.com\/oauth2\/authorize&#8217;<br \/>    TOKEN_URL = &#8216;https:\/\/api.dropboxapi.com\/oauth2\/token&#8217;<\/p><p>\u30bd\u30fc\u30b9\u3092\u78ba\u8a8d\u3057\u306a\u304c\u3089\u3001\u305d\u306e\u307e\u307e\u4e0b\u3078\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u305f\u3089\u3001test_access\u304c\u3042\u308b\u3002<\/p><p class=\"has-white-color has-black-background-color has-text-color has-background\">    def test_access(self):<br \/>        body = {<br \/>            &#8216;path&#8217;: self._clean_location(),<br \/>            &#8216;recursive&#8217;: False,<br \/>            &#8216;include_media_info&#8217;: False,<br \/>            &#8216;include_deleted&#8217;: False,<br \/>        }<br \/><br \/>        body = json.dumps(body)<br \/>        headers = {&#8216;Content-Type&#8217;: &#8216;application\/json&#8217;}<\/p><p class=\"has-text-align-left\">\u8fd1\u304f\u306a\u3063\u3066\u304d\u305f\u3067\u3002\u3082\u3046\u5c11\u3057\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u3066request\u3092\u767a\u898b\uff01body\u3092\u30a8\u30f3\u30b3\u30fc\u30c9\u3057\u305f\u3063\u3066\u304f\u308c\u3002\u8d64\u5b57\u306e\u5909\u66f4\u3092\u3059\u308b\u3002<\/p><p class=\"has-white-color has-black-background-color has-text-color has-background\">        try:<br \/><mark style=\"background-color:rgba(0,0,0,0);color:#abb8c3\" class=\"has-inline-color has-cyan-bluish-gray-color\">#\u5143            self._request(self.LIST_FOLDER_URL, body, headers)<\/mark><br \/>            self._request(self.LIST_FOLDER_URL, body<mark style=\"background-color:rgba(0,0,0,0);color:#cf2e2e\" class=\"has-inline-color has-vivid-red-color\">.encode()<\/mark>, headers)<br \/>            return True<\/p><p>\u5909\u66f4\u3092\u4fdd\u5b58(ctrl+s,ctrl+x)\u3057\u305f\u3089<\/p><h2 class=\"wp-block-heading\">MotionEye\u306e\u30ea\u30b9\u30bf\u30fc\u30c8<\/h2><ul class=\"has-white-color has-black-background-color has-text-color has-background wp-block-list\"><li>sudo systemctl restart motioneye<\/li><\/ul><h2 class=\"wp-block-heading\">\u30b5\u30fc\u30d3\u30b9\u306e\u72b6\u614b\u3092\u78ba\u8a8d<\/h2><ul class=\"has-white-color has-black-background-color has-text-color has-background wp-block-list\"><li>sudo systemctl status motioneye<\/li><\/ul><h2 class=\"wp-block-heading\">\u901a\u5e38\u3001\u3053\u3061\u3089\u3082\u5909\u66f4\u3059\u308b\u5fc5\u8981\u3042\u308a<\/h2><figure class=\"wp-block-embed is-type-wp-embed is-provider-sgg-039-s wp-block-embed-sgg-039-s\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"dnUfhq2kHC\"><a href=\"https:\/\/okamoto3.com\/index.php\/2023\/02\/03\/motioneye-dropbox-up-error\/2764\/\">MotionEye, MotionEye.eo\u3000Dropbox Invalid client_id\u3000\u76f4\u3057\u65b9<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;MotionEye, MotionEye.eo\u3000Dropbox Invalid client_id\u3000\u76f4\u3057\u65b9&#8221; &#8212; sGG&#039;s\" src=\"https:\/\/okamoto3.com\/index.php\/2023\/02\/03\/motioneye-dropbox-up-error\/2764\/embed\/#?secret=lk6CUK411m#?secret=dnUfhq2kHC\" data-secret=\"dnUfhq2kHC\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure><p class=\"has-text-align-center\">\u53c2\u8003\u307e\u3067<\/p><p class=\"has-text-align-left\">\u4ee5\u4e0a<\/p><hr class=\"wp-block-separator has-css-opacity\"\/><div class=\"wp-block-image is-style-rounded\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"400\" src=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2022\/11\/img_20220407_2354325993026044766018607.jpg?resize=400%2C400&#038;ssl=1\" alt=\"\" class=\"wp-image-2621\" srcset=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2022\/11\/img_20220407_2354325993026044766018607.jpg?w=400&amp;ssl=1 400w, https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2022\/11\/img_20220407_2354325993026044766018607.jpg?resize=300%2C300&amp;ssl=1 300w, https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2022\/11\/img_20220407_2354325993026044766018607.jpg?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2022\/11\/img_20220407_2354325993026044766018607.jpg?resize=100%2C100&amp;ssl=1 100w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/figure><\/div><hr class=\"wp-block-separator has-css-opacity\"\/>","protected":false},"excerpt":{"rendered":"<p>MotionEye\u3067Dropbox\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3088\u3046\u3068\u3057\u305f\u3089\u3053\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u30cf\u30de\u3063\u305f\uff01\u306a\u3093\u3068\u304b\u89e3\u6c7a\u3057\u305f\u306e\u3067\u3001\u3055\u3089\u3059\u3002 MotionEye\u3082MotionEye.eo\u3082\u540c\u3058\u3084\u308a\u65b9\u3067OK! Accessing the upl&hellip; <a class=\"more-link\" href=\"https:\/\/okamoto3.com\/index.php\/2023\/02\/03\/motioneye-post-data\/2774\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">MotionEye, MotionEye .eo post data cannot be of type str!\u3000\u76f4\u3057\u65b9<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":2781,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[213,54],"tags":[190],"class_list":["post-2774","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-all-articles","category-setting","tag-motioneye","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2023\/02\/IMG_20230202_204317.jpg?fit=287%2C287&ssl=1","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/posts\/2774","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/comments?post=2774"}],"version-history":[{"count":15,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/posts\/2774\/revisions"}],"predecessor-version":[{"id":3098,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/posts\/2774\/revisions\/3098"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/media\/2781"}],"wp:attachment":[{"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/media?parent=2774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/categories?post=2774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/tags?post=2774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}