{"id":5235,"date":"2019-11-25T21:34:21","date_gmt":"2019-11-25T21:34:21","guid":{"rendered":"https:\/\/holypython.com\/?p=5235"},"modified":"2021-03-28T13:22:14","modified_gmt":"2021-03-28T13:22:14","slug":"api-8-plant-info","status":"publish","type":"post","link":"https:\/\/holypython.com\/api-8-plant-info\/","title":{"rendered":"Plant Info API"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"5235\" class=\"elementor elementor-5235\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-53b32a8 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"53b32a8\" data-element_type=\"section\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-cfc2f91\" data-id=\"cfc2f91\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2d2899d elementor-widget elementor-widget-heading\" data-id=\"2d2899d\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><b>Plant Info Database<\/b><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-eeb1e41 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"eeb1e41\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b341562\" data-id=\"b341562\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-789b5c1 elementor-widget elementor-widget-text-editor\" data-id=\"789b5c1\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Trefle.io is an API that will provide plant data for a vast amount of botanic species.<\/p><p>Here is a simply code that uses\u00a0<b>requests<\/b>, <b>json<\/b> and <b>webbrowser <\/b>libraries harmoniously.<\/p><p>Code below demonstrates a simple access to Trefle.io using a Python code. You will need to replace your own token with the &#8220;XXXXX&#8221; parameters. You can register\u00a0<a href=\"https:\/\/trefle.io\/registrations\" target=\"_blank\" rel=\"noopener\">here<\/a>\u00a0for free to get a unique API key.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e1aa9a4 elementor-widget elementor-widget-html\" data-id=\"e1aa9a4\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"PYTHON\"><code>\r\nimport requests\r\nimport json\r\nimport webbrowser\r\n\r\nf = r\"http:\/\/trefle.io\/api\/plants?q=Chrysanthemum\"\r\ndef plants(f):\r\n    \r\n    paramss = {\"token\": \"XXXXXXXXXXXXXXXXXXXXXXXX\"}\r\n    data = requests.get(f, params = paramss)\r\n    \r\n    tt = json.loads(data.text)\r\n    return tt\r\n\r\n\r\na = plants(f)\r\n\r\nfor i in a:\r\n#webbrowser.open(i[\"link\"]+\"?token=XXXXXXXXXXXXXXXXXXXXXXX\")\r\n    print(i[\"slug\"])\r\n\r\nplants(f)\r\n<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ce79508 elementor-widget elementor-widget-text-editor\" data-id=\"ce79508\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>If you need a refresher on user defined functions lesson in Python here is a link to our <a href=\"https:\/\/holypython.com\/beginner-python-lessons\/lesson-16-defining-functions\/\">Defining Functions Lesson<\/a>.<\/p><p><b>Source of API: <\/b><a href=\"https:\/\/trefle.io\/reference\" target=\"_blank\" rel=\"noopener\">Trefle.io<\/a><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Plant Info Database Trefle.io is an API that will provide plant data for a vast amount of botanic species. Here is a simply code that uses\u00a0requests, json and webbrowser libraries harmoniously. Code below demonstrates a simple access to Trefle.io using a Python code. You will need to replace your own token with the &#8220;XXXXX&#8221; parameters. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3665,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[39],"tags":[],"class_list":["post-5235","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-api"],"acf":[],"_links":{"self":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/posts\/5235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/comments?post=5235"}],"version-history":[{"count":0,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/posts\/5235\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/media\/3665"}],"wp:attachment":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/media?parent=5235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/categories?post=5235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/tags?post=5235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}