{"id":5238,"date":"2019-11-25T21:35:55","date_gmt":"2019-11-25T21:35:55","guid":{"rendered":"https:\/\/holypython.com\/?p=5238"},"modified":"2021-03-28T13:23:04","modified_gmt":"2021-03-28T13:23:04","slug":"api-9-special-numbers","status":"publish","type":"post","link":"https:\/\/holypython.com\/api-9-special-numbers\/","title":{"rendered":"Special Numbers API"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"5238\" class=\"elementor elementor-5238\">\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>Special Numbers<\/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-39d1da3 elementor-widget elementor-widget-text-editor\" data-id=\"39d1da3\" 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>Numbersapi is a great API full of fun facts about numbers and dates. With the help of <b>webbrowser<\/b>\u00a0library we can then open these links right from the python terminal.<\/p><p>Here is a simply code that uses\u00a0<b>requests<\/b>, <b>json<\/b> and <b>webbrowser <\/b>libraries.<\/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-0cdaec3 elementor-widget elementor-widget-html\" data-id=\"0cdaec3\" 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>http:\/\/numbersapi.com\r\n\r\n>>> f = r\"http:\/\/numbersapi.com\/42\"\r\n>>> data = requests.get(f)\r\n>>> data.text\r\n\r\nYou can use random to get random results\r\nAlso you can use 4 categories (it will default to trivia if not mentioned)\r\n>>> f = r\"http:\/\/numbersapi.com\/random?json\"\r\n>>> f = r\"http:\/\/numbersapi.com\/random\/date?json\"\r\n>>> f = r\"http:\/\/numbersapi.com\/random\/year?json\"\r\n>>> f = r\"http:\/\/numbersapi.com\/random\/math?json\"<\/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>\u00a0<a href=\"http:\/\/numbersapi.com\/\" target=\"_blank\" rel=\"noopener\">NumbersAPI<\/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>Special Numbers Numbersapi is a great API full of fun facts about numbers and dates. With the help of webbrowser\u00a0library we can then open these links right from the python terminal. Here is a simply code that uses\u00a0requests, json and webbrowser libraries. http:\/\/numbersapi.com >>> f = r&#8221;http:\/\/numbersapi.com\/42&#8243; >>> data = requests.get(f) >>> data.text You can [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5357,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[39],"tags":[],"class_list":["post-5238","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\/5238","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=5238"}],"version-history":[{"count":0,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/posts\/5238\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/media\/5357"}],"wp:attachment":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/media?parent=5238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/categories?post=5238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/tags?post=5238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}