{"id":715,"date":"2022-02-24T13:11:02","date_gmt":"2022-02-24T18:11:02","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=715"},"modified":"2022-02-24T13:11:04","modified_gmt":"2022-02-24T18:11:04","slug":"python-code-to-download-content-from-internet","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/python-code-to-download-content-from-internet\/","title":{"rendered":"Python code to download content from Internet"},"content":{"rendered":"\n<p>The following code downloads content from a web address:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import urllib.request\nurl = 'http:\/\/molecularsciences.org'\nresponse = urllib.request.urlopen(url)\nmydata = response.read()\nmytext = text.decode('utf-8')\nprint(mytext)<\/code><\/pre>\n\n\n\n<p>First, we import the urllib library. Third line defines the request. Fourth line read the actual content. Fifth line decodes utf-8. Finally we print the output to screen. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following code downloads content from a web address: First, we import the urllib library. Third line defines the request. Fourth line read the actual content. Fifth line decodes utf-8. Finally we print the output to screen.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[203],"tags":[137],"class_list":["post-715","post","type-post","status-publish","format-standard","hentry","category-python","tag-python"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=715"}],"version-history":[{"count":1,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/715\/revisions"}],"predecessor-version":[{"id":716,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/715\/revisions\/716"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=715"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}