{"id":3101,"date":"2018-07-16T21:39:08","date_gmt":"2018-07-16T12:39:08","guid":{"rendered":"https:\/\/akamist.com\/blog\/?p=3101"},"modified":"2018-08-19T18:52:31","modified_gmt":"2018-08-19T09:52:31","slug":"python3requests-get%e3%81%ae%e7%b5%90%e6%9e%9c%e3%82%92%e6%96%87%e5%ad%97%e5%88%97%e3%81%a8%e3%81%97%e3%81%a6%e5%8f%96%e5%be%97%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/akamist.com\/blog\/archives\/3101","title":{"rendered":"[python3]requests.get()\u306e\u7d50\u679c\u3092\u6587\u5b57\u5217\u3068\u3057\u3066\u53d6\u5f97\u3059\u308b"},"content":{"rendered":"<p>python\u3067\u306f\u3001request\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u304b\u3089http\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>requests.get()\u3067\u5b9f\u884c\u3057\u305f\u305fHTTP\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u5bfe\u3059\u308b\u5fdc\u7b54\u30c6\u30ad\u30b9\u30c8\u3092string\u306e\u6587\u5b57\u5217\u3068\u3057\u3066\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u623b\u308a\u5024\u306b\u5bfe\u3057\u3066content.decode()\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-python\">import requests\n\nres = requests.get('https:\/\/www.yahoo.co.jp')\nprint(type(res))                   # &lt;class 'requests.models.Response'&gt;\nprint(type(res.content))           # &lt;class 'bytes'&gt;\nprint(type(res.content.decode()))  # &lt;class 'str'&gt;\n\nprint(res.content.decode())   # \u7d50\u679c\u3092\u6587\u5b57\u5217\u3068\u3057\u3066\u51fa\u529b\u3067\u304d\u308b\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>python\u3067\u306f\u3001request\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u304b\u3089http\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 requests.get()\u3067\u5b9f\u884c\u3057\u305f\u305fHTTP\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u5bfe\u3059\u308b\u5fdc\u7b54\u30c6\u30ad\u30b9\u30c8\u3092string\u306e\u6587\u5b57\u5217 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2612,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[45],"tags":[198],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/akamist.com\/blog\/wp-content\/uploads\/2018\/05\/icon_python.png","jetpack-related-posts":[{"id":3057,"url":"https:\/\/akamist.com\/blog\/archives\/3057","url_meta":{"origin":3101,"position":0},"title":"[python]\u8907\u6570\u306eurl\u3092\u6e21\u3057\u3066,\u8907\u6570\u30b5\u30a4\u30c8\u306e\u30da\u30fc\u30b8\u30bf\u30a4\u30c8\u30eb\u3092\u4e00\u5ea6\u306b\u53d6\u5f97\u3059\u308b","date":"2018\u5e747\u67088\u65e5","format":false,"excerpt":"URL\u306e\u4e00\u89a7\u3092\u6e21\u3057\u3066\u30da\u30fc\u30b8\u306e\u30bf\u30a4\u30c8\u30eb\u3092\u307e\u3068\u3081\u3066\u53d6\u5f97\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092python\u3067\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002 ##\u2026","rel":"","context":"\u672a\u5206\u985e","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2018\/05\/icon_python.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3008,"url":"https:\/\/akamist.com\/blog\/archives\/3008","url_meta":{"origin":3101,"position":1},"title":"[python]BeautifulSoup\u3092\u4f7f\u7528\u6642\u306b\u8b66\u544a\u300cUserWarning: No parser was explicitly specified\u300d\u304c\u51fa\u308b\u3068\u304d","date":"2018\u5e747\u67081\u65e5","format":false,"excerpt":"python\u3067BeautifulSoup\u3092\u4f7f\u304a\u3046\u3068\u3057\u305f\u3068\u304d\u306b\u300cUserWarning: No par\u2026","rel":"","context":"python","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2018\/05\/icon_python.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1069,"url":"https:\/\/akamist.com\/blog\/archives\/1069","url_meta":{"origin":3101,"position":2},"title":"[Linux]\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u81ea\u52d5\u751f\u6210\u3059\u308b","date":"2017\u5e7411\u670817\u65e5","format":false,"excerpt":"Linux\u306e\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u51e6\u7406\u3092\u81ea\u52d5\u5316\u3059\u308b\u6642\u3001\u521d\u671f\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u30e9\u30f3\u30c0\u30e0\u306a\u5024\u3067\u30bb\u30c3\u30c8\u3057\u305f\u3044\u5834\u5408\u304c\u3042\u2026","rel":"","context":"Linux","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2017\/10\/icon_linux.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2673,"url":"https:\/\/akamist.com\/blog\/archives\/2673","url_meta":{"origin":3101,"position":3},"title":"[python]\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u8eab\u5168\u4f53\u3092\u53d6\u5f97\u3057\u3066\u3001\u6539\u884c\u3092\u53d6\u308a\u9664\u304f","date":"2018\u5e745\u67088\u65e5","format":false,"excerpt":"python\u3092\u4f7f\u3063\u3066\u3001\u6307\u5b9a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9\u5168\u90e8\u3092\u53d6\u5f97\u3057\u305f\u4e0a\u3067\u3001\u30d5\u30a1\u30a4\u30eb\u5185\u306b\u542b\u307e\u308c\u308b\u6539\u884c\u3092\u53d6\u308a\u9664\u304d\u2026","rel":"","context":"python","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2018\/05\/icon_python.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2691,"url":"https:\/\/akamist.com\/blog\/archives\/2691","url_meta":{"origin":3101,"position":4},"title":"[python]\u6587\u5b57\u3068\u6570\u5b57\u3092\"+\"\u3067\u9023\u7d50\u3059\u308b\u3068\u30a8\u30e9\u30fc\"TypeError: must be str, not int\"","date":"2018\u5e745\u670812\u65e5","format":false,"excerpt":"python\u3067\u6587\u5b57\u5217\u3068\u6570\u5024\u3092`+`\u6f14\u7b97\u5b50\u3067\u9023\u7d50\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306bTypeError: must b\u2026","rel":"","context":"python","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2018\/05\/icon_python.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3016,"url":"https:\/\/akamist.com\/blog\/archives\/3016","url_meta":{"origin":3101,"position":5},"title":"[python]SAO\u30c6\u30ec\u30d3\u30b7\u30ea\u30fc\u30ba(\u82f1\u8a9e\u7248)\u306e\u5b57\u5e55\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0\u3059\u308b(Sword Art Online)","date":"2018\u5e747\u67083\u65e5","format":false,"excerpt":"animetranscripts.wikispaces.com\u3068\u3044\u3046\u30b5\u30a4\u30c8\u3067\u306f\u3001\u82f1\u8a9e\u7248\u304c\u51fa\u3066\u3044\u308b\u30a2\u30cb\u2026","rel":"","context":"python","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2018\/05\/icon_python.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/3101"}],"collection":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/comments?post=3101"}],"version-history":[{"count":2,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/3101\/revisions"}],"predecessor-version":[{"id":3103,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/3101\/revisions\/3103"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/media\/2612"}],"wp:attachment":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/media?parent=3101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/categories?post=3101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/tags?post=3101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}