{"id":5299,"date":"2019-11-26T15:06:12","date_gmt":"2019-11-26T15:06:12","guid":{"rendered":"https:\/\/holypython.com\/?p=5299"},"modified":"2021-03-28T13:25:04","modified_gmt":"2021-03-28T13:25:04","slug":"api-19-chuck-norris-jokes","status":"publish","type":"post","link":"https:\/\/holypython.com\/api-19-chuck-norris-jokes\/","title":{"rendered":"Chuck Norris Jokes API"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"5299\" class=\"elementor elementor-5299\">\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>Chuck Norries Joke 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-ceacc3b elementor-widget elementor-widget-text-editor\" data-id=\"ceacc3b\" 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>ICNDB is a fun database full of Chuck Norris jokes. If you&#8217;re a fan, it&#8217;ll be a while before you run out of Chuck Norris jokes again.<\/p><p>According to <a href=\"http:\/\/www.icndb.com\" target=\"_blank\" rel=\"noopener\">ICNDB<\/a>, The phrase &#8216;break a leg&#8217; was originally coined by Chuck Norris&#8217;s co-stars in Walker, Texas Ranger as a good luck charm, indicating that a broken leg might be the worst extent of their injuries. This never proved to be the case.<\/p><p>Here is a simply code that uses\u00a0<b>requests <\/b>and\u00a0<b>json<\/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-98f94ec elementor-widget elementor-widget-text-editor\" data-id=\"98f94ec\" 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>Below code will fetch a single random joke:<\/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-acbf44b elementor-widget elementor-widget-html\" data-id=\"acbf44b\" 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><code>import requests\r\nimport json\r\n\r\ndef chuck():\r\n\r\n    f = r\"http:\/\/api.icndb.com\/jokes\/random\"\r\n    data = requests.get(f)\r\n    tt = json.loads(data.text)\r\n    \r\n    print(tt[\"value\"][\"joke\"])\r\n\r\nchuck()<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c00889b elementor-widget elementor-widget-text-editor\" data-id=\"c00889b\" 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>Below code will fetch 5 random jokes:<\/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-ece720b elementor-widget elementor-widget-html\" data-id=\"ece720b\" 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><code>import requests\r\nimport json\r\n\r\ndef chuck():\r\n\r\n    f = r\"http:\/\/api.icndb.com\/jokes\/random\/5\"\r\n    data = requests.get(f)\r\n    tt = json.loads(data.text)\r\n    \r\n    print(tt[\"value\"][\"joke\"])\r\n\r\nchuck()<\/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><b>Source of API:<\/b>\u00a0<a href=\"http:\/\/www.icndb.com\/api\/\" target=\"_blank\" rel=\"noopener\">The Internet Chuck Norris Database<\/a><\/p><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>\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-35d1834 elementor-widget elementor-widget-image\" data-id=\"35d1834\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"414\" height=\"330\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/download.png\" class=\"attachment-Image Size 500x500 size-Image Size 500x500 wp-image-5308\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/download.png 414w, https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/download-300x239.png 300w\" sizes=\"(max-width: 414px) 100vw, 414px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Chuck Norris Portrait in Cowboy Hat<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\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>Chuck Norries Joke Database ICNDB is a fun database full of Chuck Norris jokes. If you&#8217;re a fan, it&#8217;ll be a while before you run out of Chuck Norris jokes again. According to ICNDB, The phrase &#8216;break a leg&#8217; was originally coined by Chuck Norris&#8217;s co-stars in Walker, Texas Ranger as a good luck charm, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5508,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[39],"tags":[],"class_list":["post-5299","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\/5299","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=5299"}],"version-history":[{"count":0,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/posts\/5299\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/media\/5508"}],"wp:attachment":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/media?parent=5299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/categories?post=5299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/tags?post=5299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}