{"id":4945,"date":"2015-06-01T16:15:08","date_gmt":"2015-06-01T13:15:08","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=4945"},"modified":"2015-05-27T23:59:01","modified_gmt":"2015-05-27T20:59:01","slug":"python-refactoring-iterator","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/","title":{"rendered":"Python: Refactoring to iterator"},"content":{"rendered":"<p>Over the last week I\u2019ve been building a set of scripts to scrape the events from the <a href=\"http:\/\/www.bbc.co.uk\/sport\/0\/football\/32683310\">Bayern Munich\/Barcelona game<\/a> and I\u2019ve ended up with a few hundred lines of nested for statements, if statements and mutated lists. I thought it was about time I did a bit of refactoring.<\/p>\n<p>The following is a function which takes in a match file and spits out a collection of maps containing times &amp; events.<\/p>\n<p>&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<pre class=\" brush:py\">import bs4\r\nimport re\r\nfrom bs4 import BeautifulSoup\r\nfrom soupselect import select\r\n\u00a0\r\ndef extract_events(file):\r\n    match = open(file, 'r')\r\n    soup = BeautifulSoup(match.read())\r\n\u00a0\r\n    all_events = []\r\n    for event in select(soup, 'div#live-text-commentary-wrapper div#live-text'):\r\n        for child in event.children:\r\n            if type(child) is bs4.element.Tag:\r\n                all_events.append(child.getText().strip())\r\n\u00a0\r\n    for event in select(soup, 'div#live-text-commentary-wrapper div#more-live-text'):\r\n        for child in event.children:\r\n            if type(child) is bs4.element.Tag:\r\n                all_events.append(child.getText().strip())\r\n\u00a0\r\n    timed_events = []\r\n    for i in range(0, len(all_events)):\r\n        event = all_events[i]\r\n        time =  re.findall(\"\\d{1,2}:\\d{2}\", event)\r\n        formatted_time = \" +\".join(time)\r\n        if time:\r\n            timed_events.append({'time': formatted_time, 'event': all_events[i+1]})\r\n    return timed_events<\/pre>\n<p>We call it like this:<\/p>\n<pre class=\" brush:py\">match_id = \"32683310\"\r\nfor event in extract_events(\"data\/%s\" % (match_id))[:10]:\r\n    print event<\/pre>\n<p>The file we\u2019re loading is the <a href=\"http:\/\/www.bbc.co.uk\/sport\/0\/football\/32683310\">Bayern Munich vs Barcelona match<\/a> HTML file which I have saved locally. After we\u2019ve got that read into beautiful soup we locate the two divs on the page which contain the match events.<\/p>\n<p>We then iterate over that list and create a new list containing (time, event) pairs which we return.<\/p>\n<p>I think we should be able to get to our resulting collection without persisting an intermediate list, but first things first \u2013 let\u2019s remove the duplicated for loops:<\/p>\n<pre class=\" brush:py\">def extract_events(file):\r\n    match = open(file, 'r')\r\n    soup = BeautifulSoup(match.read())\r\n\u00a0\r\n    all_events = []\r\n    events = select(soup, 'div#live-text-commentary-wrapper div#live-text')\r\n    more_events = select(soup, 'div#live-text-commentary-wrapper div#more-live-text')\r\n\u00a0\r\n    for event in events + more_events:\r\n        for child in event.children:\r\n            if type(child) is bs4.element.Tag:\r\n                all_events.append(child.getText().strip())\r\n\u00a0\r\n    timed_events = []\r\n    for i in range(0, len(all_events)):\r\n        event = all_events[i]\r\n        time =  re.findall(\"\\d{1,2}:\\d{2}\", event)\r\n        formatted_time = \" +\".join(time)\r\n        if time:\r\n            timed_events.append({'time': formatted_time, 'event': all_events[i+1]})\r\n    return timed_events<\/pre>\n<p>The next step is to refactor towards using an iterator. After <a href=\"http:\/\/anandology.com\/python-practice-book\/iterators.html#generators\">a bit of reading<\/a> I realised a generator would make life even easier.<\/p>\n<p>I created a function which returned an iterator of the raw events and plugged that into the original function:<\/p>\n<pre class=\" brush:py\">def raw_events(file):\r\n    match = open(file, 'r')\r\n    soup = BeautifulSoup(match.read())\r\n    events = select(soup, 'div#live-text-commentary-wrapper div#live-text')\r\n    more_events = select(soup, 'div#live-text-commentary-wrapper div#more-live-text')\r\n    for event in events + more_events:\r\n        for child in event.children:\r\n            if type(child) is bs4.element.Tag:\r\n                yield child.getText().strip()\r\n\u00a0\r\ndef extract_events(file):\r\n    all_events = list(raw_events(file))\r\n\u00a0\r\n    timed_events = []\r\n    for i in range(0, len(all_events)):\r\n        event = all_events[i]\r\n        time =  re.findall(\"\\d{1,2}:\\d{2}\", event)\r\n        formatted_time = \" +\".join(time)\r\n        if time:\r\n            timed_events.append({'time': formatted_time, 'event': all_events[i+1]})\r\n    return timed_events<\/pre>\n<p>If we run that function we still get the same output as before which is good. Now we need to work out how to clean up the second bit of the code which groups the appropriate rows together.<\/p>\n<p>The goal is that \u2018extract_events\u2019 returns an iterator rather than a list \u2013 we need to figure out how to iterate over the output of \u2018raw_events\u2019 in such a way that when we find a \u2018time row\u2019 we can yield that and the row immediately after.<\/p>\n<p>Luckily I found <a href=\"http:\/\/stackoverflow.com\/questions\/16789776\/iterating-over-two-values-of-a-list-at-a-time-in-python\">a Stack Overflow post<\/a> explaining that you can use the \u2018next\u2019 function inside an iterator to achieve this:<\/p>\n<pre class=\" brush:py\">def extract_events(file):\r\n    events = raw_events(file)\r\n    for event in events:\r\n        time =  re.findall(\"\\d{1,2}:\\d{2}\", event)\r\n        formatted_time = \" +\".join(time)\r\n        if time:\r\n            yield {'time': formatted_time, 'event': next(events)}<\/pre>\n<p>It\u2019s not that much less code than the original function but I think it\u2019s an improvement. Any thoughts\/tips to simplify it further are always welcome.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/www.markhneedham.com\/blog\/2015\/05\/23\/python-refactoring-to-iterator\/\">Python: Refactoring to iterator<\/a> from our <a href=\"http:\/\/www.webcodegeeks.com\/wcg\/\">WCG partner<\/a> Mark Needham at the <a href=\"http:\/\/www.markhneedham.com\/blog\/\">Mark Needham Blog<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Over the last week I\u2019ve been building a set of scripts to scrape the events from the Bayern Munich\/Barcelona game and I\u2019ve ended up with a few hundred lines of nested for statements, if statements and mutated lists. I thought it was about time I did a bit of refactoring. The following is a function &hellip;<\/p>\n","protected":false},"author":48,"featured_media":1651,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[],"class_list":["post-4945","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python: Refactoring to iterator - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Over the last week I\u2019ve been building a set of scripts to scrape the events from the Bayern Munich\/Barcelona game and I\u2019ve ended up with a few hundred\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python: Refactoring to iterator - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Over the last week I\u2019ve been building a set of scripts to scrape the events from the Bayern Munich\/Barcelona game and I\u2019ve ended up with a few hundred\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-06-01T13:15:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Mark Needham\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mark Needham\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/\"},\"author\":{\"name\":\"Mark Needham\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/848a54e2ee724e46069ce36c2e52e98e\"},\"headline\":\"Python: Refactoring to iterator\",\"datePublished\":\"2015-06-01T13:15:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/\"},\"wordCount\":369,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/\",\"name\":\"Python: Refactoring to iterator - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"datePublished\":\"2015-06-01T13:15:08+00:00\",\"description\":\"Over the last week I\u2019ve been building a set of scripts to scrape the events from the Bayern Munich\/Barcelona game and I\u2019ve ended up with a few hundred\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python: Refactoring to iterator\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/848a54e2ee724e46069ce36c2e52e98e\",\"name\":\"Mark Needham\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g\",\"caption\":\"Mark Needham\"},\"sameAs\":[\"http:\/\/www.markhneedham.com\/blog\/\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/mark-needham\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python: Refactoring to iterator - Web Code Geeks - 2026","description":"Over the last week I\u2019ve been building a set of scripts to scrape the events from the Bayern Munich\/Barcelona game and I\u2019ve ended up with a few hundred","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/","og_locale":"en_US","og_type":"article","og_title":"Python: Refactoring to iterator - Web Code Geeks - 2026","og_description":"Over the last week I\u2019ve been building a set of scripts to scrape the events from the Bayern Munich\/Barcelona game and I\u2019ve ended up with a few hundred","og_url":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2015-06-01T13:15:08+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","type":"image\/jpeg"}],"author":"Mark Needham","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Mark Needham","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/"},"author":{"name":"Mark Needham","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/848a54e2ee724e46069ce36c2e52e98e"},"headline":"Python: Refactoring to iterator","datePublished":"2015-06-01T13:15:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/"},"wordCount":369,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/","url":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/","name":"Python: Refactoring to iterator - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","datePublished":"2015-06-01T13:15:08+00:00","description":"Over the last week I\u2019ve been building a set of scripts to scrape the events from the Bayern Munich\/Barcelona game and I\u2019ve ended up with a few hundred","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/python\/python-refactoring-iterator\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/www.webcodegeeks.com\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python: Refactoring to iterator"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/848a54e2ee724e46069ce36c2e52e98e","name":"Mark Needham","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g","caption":"Mark Needham"},"sameAs":["http:\/\/www.markhneedham.com\/blog\/"],"url":"https:\/\/www.webcodegeeks.com\/author\/mark-needham\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/4945","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/48"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=4945"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/4945\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/1651"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=4945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=4945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=4945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}