<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: DishyDev</title>
    <description>The latest articles on DEV Community by DishyDev (@sg3141592).</description>
    <link>https://dev.to/sg3141592</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F340030%2F405c6423-c9f1-4ece-9ff6-f30fcfe73f96.PNG</url>
      <title>DEV Community: DishyDev</title>
      <link>https://dev.to/sg3141592</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sg3141592"/>
    <language>en</language>
    <item>
      <title>Hacking together a quick multiplayer browser game to play during lockdown</title>
      <dc:creator>DishyDev</dc:creator>
      <pubDate>Sat, 25 Apr 2020 17:50:45 +0000</pubDate>
      <link>https://dev.to/sg3141592/hacking-together-a-quick-multiplayer-browser-game-to-play-during-lockdown-f69</link>
      <guid>https://dev.to/sg3141592/hacking-together-a-quick-multiplayer-browser-game-to-play-during-lockdown-f69</guid>
      <description>&lt;h1&gt;
  
  
  Hacking together a quick multiplayer browser game to play during lockdown
&lt;/h1&gt;

&lt;p&gt;This is a little web game I knocked together this week to play with friends during lockdown. We were looking for an easy to play simple version of Yatzy and all of the ones we were finding required linking your social media, going through long tutorials and had micro-transactions.&lt;/p&gt;

&lt;p&gt;So I spent my evenings this week knocking together a simple multiplayer web app version to play.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://yatzyonline.azurewebsites.net/"&gt;And here's a link to what I created - Yatzy&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ufy_1GLf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://www.dishy.dev/articles/images/YatzyWide.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ufy_1GLf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://www.dishy.dev/articles/images/YatzyWide.gif" alt="Demo Video of Game"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The philosophy of it
&lt;/h2&gt;

&lt;p&gt;I was inspired by the CodeNames game you can play at &lt;a href="https://www.horsepaste.com/"&gt;horsepaste.com&lt;/a&gt; which is a simple easy to play implementation of the game. You just come up with a unique game code, and anyone who has that code can join.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rcptHkCH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/yatzy-login-screen.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rcptHkCH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/yatzy-login-screen.PNG" alt="Yatzy Login Screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The architecture
&lt;/h2&gt;

&lt;p&gt;The rough architecture of the game looked like this. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u3lxjvNf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/app-architecture-overview.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u3lxjvNf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/app-architecture-overview.PNG" alt="Application Architecture Overview"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://bulma.io"&gt;Bulma&lt;/a&gt; is a really clean, simple to use CSS only front-end framework. It resizes really nicely onto mobile devices.&lt;/li&gt;
&lt;li&gt;A bit of &lt;a href="https://jquery.com/"&gt;JQuery&lt;/a&gt; was used to provide dynamic behaviour for the front-end. I know JQuery very out of style at the moment but I like how quick you can get up and running it with, and I didn't feel my app was complex enough to need React/Angular/Vue.&lt;/li&gt;
&lt;li&gt;The logic of the game was implemented with a basic Python &lt;a href="https://flask.palletsprojects.com/"&gt;Flask&lt;/a&gt; app. &lt;/li&gt;
&lt;li&gt;And I used &lt;a href="https://azure.microsoft.com/en-gb/services/storage/tables/"&gt;Azure Table Storage&lt;/a&gt; to handle managing game state, scores, player lists etc. It's a simple documentDB store and its very cheap compared to SQL DBs on Azure.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;I've been pretty pleased with the results. Nothing ground breaking, but a very playable experience.&lt;/p&gt;

&lt;p&gt;I'll be doing more articles going forward about performance, some of the horrible hacks used to get it going and some reflections on what I learned. But for now if you want to have a play on the game you can &lt;a href="https://yatzyonline.azurewebsites.net/"&gt;do so here - Yatzy&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>python</category>
      <category>azure</category>
    </item>
    <item>
      <title>Creating a Reddit /r/anime Image Scraper</title>
      <dc:creator>DishyDev</dc:creator>
      <pubDate>Thu, 27 Feb 2020 20:20:22 +0000</pubDate>
      <link>https://dev.to/sg3141592/creating-a-reddit-r-anime-image-scraper-23hl</link>
      <guid>https://dev.to/sg3141592/creating-a-reddit-r-anime-image-scraper-23hl</guid>
      <description>&lt;h1&gt;
  
  
  Scraping Images from Reddit /r/anime
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KsDWnk4r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://www.dishy.dev/articles/images/RedditScraperV2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KsDWnk4r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://www.dishy.dev/articles/images/RedditScraperV2.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Following on from my previous article about &lt;a href="https://dev.to/sg3141592/scraping-images-from-reddit-threads-in-python-3pke"&gt;scraping images from Reddit&lt;/a&gt;, I decided to expand the concept out to a more fully featured tool.&lt;/p&gt;

&lt;p&gt;I think Reddit's &lt;strong&gt;/r/anime&lt;/strong&gt; is one of the most entertaining and best subreddits. Something that drives this is they have a bot that creates discussion threads for new episodes as they go out. They generate a lot of discussion and screenshots for shows.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UCZDItZv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/anime-discussion-threads.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UCZDItZv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/anime-discussion-threads.PNG" alt="Example of Anime discussion threads on reddit"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I noticed since the threads are generated by a bot, its easy to search and get a list of all of the discussion threads for a show.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---Pf0F4uY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/anime-episode-search.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---Pf0F4uY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/anime-episode-search.PNG" alt="A"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I decided to have a go to see how easy it was to implement an episode search.&lt;/p&gt;

&lt;h2&gt;
  
  
  Search for Episodes
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://praw.readthedocs.io/en/latest/"&gt;PRAW&lt;/a&gt; library makes it trivial to search Reddit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;subreddit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reddit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;subreddit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'anime'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;matches&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subreddit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'violet evergarden'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;250&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;From here we can RegEx someones search string into a query to find all of the threads that match the &lt;code&gt;ShowName - Episode discussion&lt;/code&gt; format.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;REGEX_STR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'.*'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;filteredName&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;' '&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;'.+'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;'.*Episode&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;D+(&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;d+).+discussion.*'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This combined with the image search from the last article machines for a nice little scraper based on show name.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frontend
&lt;/h2&gt;

&lt;p&gt;The Frontend uses a simple CSS only framework &lt;a href="https://bulma.io/"&gt;Bulma&lt;/a&gt; for the UI. I'm really impressed with how easy it is to get an image window up for the preview feature of the app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZWLTfSMI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/anime-app-fullscreen.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZWLTfSMI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/anime-app-fullscreen.PNG" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And the loading bars are nice too&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CSCwlpwV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://www.dishy.dev/articles/images/LoadingBar.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CSCwlpwV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://www.dishy.dev/articles/images/LoadingBar.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This with a bit of &lt;a href="https://jquery.com/"&gt;JQuery&lt;/a&gt; to let us search the API and populate the results. It's a bit hacky so I've not gone into much detail on it, it'll be doing more work with it for the next article. The API is all served up through &lt;a href="https://azure.microsoft.com/en-gb/services/functions/"&gt;Azure Functions&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can give it a try on my site below &lt;a href="https://dishy.dev/scraping-images-from-reddit/try-it-out-page-v2.html"&gt;Reddit Anime Scraper Version 2&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It'd be nice to allow scrolling through the images while in fullscreen mode through arrow keys or buttons each side of the image.&lt;/li&gt;
&lt;li&gt;These lookups are slow. There's an opportunity to implement a caching solution that looks at the number of comments or another flag to let us re-use lookups.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Scraping Images from Reddit Threads in Python</title>
      <dc:creator>DishyDev</dc:creator>
      <pubDate>Sun, 23 Feb 2020 18:12:25 +0000</pubDate>
      <link>https://dev.to/sg3141592/scraping-images-from-reddit-threads-in-python-3pke</link>
      <guid>https://dev.to/sg3141592/scraping-images-from-reddit-threads-in-python-3pke</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;This is a little side project I did to try and scrape images out of reddit threads. There's a few different subreddits discussing shows, specifically &lt;code&gt;/r/anime&lt;/code&gt; where users add a lot screenshots of the episodes. And I thought it'd be cool to see how much effort it'd be to automatically collate a list of those screenshots from a thread and display them in a simple gallery. The result looked like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NjRTZDYh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://www.dishy.dev/articles/images/RedditScraperVersion1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NjRTZDYh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://www.dishy.dev/articles/images/RedditScraperVersion1.gif" alt="Reddit Scraper v1 example video"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  PRAW
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://praw.readthedocs.io/en/latest/"&gt;PRAW&lt;/a&gt; is the Python Reddit API Wrapper, that provides a nice set of bindings to talk to Reddit.&lt;/p&gt;

&lt;p&gt;To scrape Reddit you need credentials. The way to generate credentials is hidden away at &lt;a href="https://www.reddit.com/prefs/apps"&gt;https://www.reddit.com/prefs/apps&lt;/a&gt; where you have to register a new "app" with Reddit. Connecting is as simple as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;praw&lt;/span&gt;

&lt;span class="n"&gt;reddit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;praw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Reddit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;client_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; \
                     &lt;span class="n"&gt;client_secret&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'secret'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; \
                     &lt;span class="n"&gt;user_agent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'useragent'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; \
                     &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'username'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; \
                     &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'DevToIsCool'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Traversing reddit is made simple by the API, for example printing all of the comments in a thread.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;submission&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reddit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;submission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://reddit.com/r/abcde"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;comment&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;submission&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;comments&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Finding links
&lt;/h2&gt;

&lt;p&gt;99% of the images I was looking for are posted to imgur so I just matched on those. I used a regular expression to extract the links. I always recommend using a tool like &lt;a href="https://regex101.com/"&gt;RegEx101&lt;/a&gt; that makes it really easy to debug your regular expressions as they can be pretty brain bending.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="n"&gt;REGEX_TEST&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;r"((http|https)://i.imgur.com/.+?(jpg|png))"&lt;/span&gt;
    &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;REGEX_TEST&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IGNORECASE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Check if an image still exists
&lt;/h2&gt;

&lt;p&gt;One of the problems I found was dead image links, so I created a simple helper that checks the status_code for that link.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Check if a link still is exists
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;checkLinkActive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Getting Thumbnails
&lt;/h2&gt;

&lt;p&gt;To save bandwidth and your mobile data I wanted to return a smaller version of the image. In &lt;a href="https://webapps.stackexchange.com/questions/16103/is-it-possible-to-find-the-thumbnail-of-an-existing-imgur-image"&gt;imgur you can append a size character onto a URL to get it at a different size&lt;/a&gt;, for example '&lt;strong&gt;l&lt;/strong&gt;' large and '&lt;strong&gt;s&lt;/strong&gt;' small.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Add a letter to an imgur url to make a small thumbnail
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;getImgurThumbnail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;startStr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;[:(&lt;/span&gt;&lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
    &lt;span class="n"&gt;endStr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;:]&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;startStr&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;endStr&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Putting it all together
&lt;/h2&gt;

&lt;p&gt;Putting all of these bits together you get&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;getImages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;submission&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reddit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;submission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Tell API to return all comment in thread, results are
&lt;/span&gt;    &lt;span class="c1"&gt;# paginated by default
&lt;/span&gt;    &lt;span class="n"&gt;submission&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;comments&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;replace_more&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Create RegEx object for matching images
&lt;/span&gt;    &lt;span class="n"&gt;REGEX_TEST&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;r"((http|https)://i.imgur.com/.+?(jpg|png))"&lt;/span&gt;
    &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;REGEX_TEST&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IGNORECASE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;imageMatches&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;comment&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;submission&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;comments&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="n"&gt;matches&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;findall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;matches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;checkLinkActive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt;
                &lt;span class="n"&gt;imageMatches&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"image"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="s"&gt;"thumbnail"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;getImgurThumbnail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="s"&gt;"m"&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
                &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;imageMatches&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Trying it out
&lt;/h2&gt;

&lt;p&gt;I decided to stand up a quick demo of this, using an Azure Function to host my new function and a simple web form to allow people to try it out. Just copy and paste a Reddit URL and the function will return any images.&lt;/p&gt;

&lt;p&gt;The Demo App uses &lt;a href="https://www.bulma.io"&gt;Bulma&lt;/a&gt; for the look and feel, and a little bit of &lt;a href="https://jquery.com/"&gt;JQuery&lt;/a&gt; for the loading of the page.&lt;/p&gt;

&lt;p&gt;If you want to give it a go, &lt;a href="https://www.dishy.dev/articles/scraping-images-from-reddit/#trying-it-out"&gt;you can have a play on my site here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;I'll be looking in a future article at providing a show name search instead of having to paste individual episode URLs. Happy Reddit scraping!&lt;/p&gt;

</description>
      <category>python</category>
      <category>azure</category>
      <category>webdev</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Deploying a quick Markdown Site on Azure</title>
      <dc:creator>DishyDev</dc:creator>
      <pubDate>Sat, 22 Feb 2020 15:11:49 +0000</pubDate>
      <link>https://dev.to/sg3141592/deploying-a-quick-markdown-site-on-azure-1lk6</link>
      <guid>https://dev.to/sg3141592/deploying-a-quick-markdown-site-on-azure-1lk6</guid>
      <description>&lt;h1&gt;
  
  
  Deploying Markdown Site on Azure
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xd-4tGyp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/mkdown-to-site.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xd-4tGyp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/mkdown-to-site.PNG" alt="Markdown page to site"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This blog was originally posted on my &lt;a href="https://www.dishy.dev/articles/generating-py-mk/"&gt;site&lt;/a&gt; and I thought I might share it here. I've found a pattern I like using a python markdown generator to get a simple site up and running quickly. I had three main requirements&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Markdown

&lt;ul&gt;
&lt;li&gt;I wanted to use Markdown as I use it day to day, and I think its a quick way to get ideas down without having to mess around with rich text formatting.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Static Site

&lt;ul&gt;
&lt;li&gt;I wanted to keep this as simple and clean as possible, just HTML, CSS and JS.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Azure

&lt;ul&gt;
&lt;li&gt;I wanted to deploy the site through Azure as its the cloud service I'm most familiar with.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  MkDocs
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.mkdocs.org/"&gt;MkDocs&lt;/a&gt; is a really elegant, fast way to build a static site from markdown. You can create a site from just a configuration file and a set of markdown files. Getting started is as simple as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;mkdocs
mkdocs new my-new-project
mkdocs serve
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And viola! You've got a site with navigation, search facility, table of contents and a theme that renders nicely on mobile and desktop.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JZYjBZNj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/mkdocs-home-screen.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JZYjBZNj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/mkdocs-home-screen.PNG" alt="MkDocs New Site Landing Page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whenever you save a change to the site it gets rebuilt.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5zzbyRRF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://www.dishy.dev/articles/images/mkdocs-update.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5zzbyRRF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://www.dishy.dev/articles/images/mkdocs-update.gif" alt="Gif of applying an update to an MkDoc"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Adding new pages and updating the navigation is just updating the root &lt;code&gt;mkdocs.yml&lt;/code&gt; YAML file to point towards new markdown files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;site_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Dishy Dev&lt;/span&gt;
&lt;span class="na"&gt;nav&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;Home&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;index.md&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;Article&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;My&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Cool&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Article'&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;articles/cool-article-1.md'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PNjWf_nl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/mkdocs-nav.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PNjWf_nl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/mkdocs-nav.PNG" alt="Example of the MkDocs Navigation Bar"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Themes
&lt;/h3&gt;

&lt;p&gt;MkDocs comes with a selection of &lt;a href="https://github.com/mkdocs/mkdocs/wiki/MkDocs-Themes"&gt;themes&lt;/a&gt; that can be easily installed through pip. In the end I went with &lt;a href="https://sourcefoundry.org/cinder/"&gt;Cinder&lt;/a&gt;, a clean style based on Bootstrap.&lt;br&gt;
After &lt;code&gt;pip install mkdocs-cinder&lt;/code&gt; getting it going was updating the &lt;code&gt;mkdocs.yml&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;theme: cinder
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GVOii3Ar--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/mkdocs-home-screen-cinder.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GVOii3Ar--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/mkdocs-home-screen-cinder.PNG" alt="MkDocs New Site with Cinder Theme applied"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Hosting Static Site
&lt;/h3&gt;

&lt;p&gt;The quickest and easiest way for me to start hosting my site was through an Azure Storage account. Azure Storage supports &lt;a href="https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website"&gt;Static Site Hosting&lt;/a&gt; where you can serve up the contents of a container called &lt;code&gt;$web&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Lnz3ySTP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/azure-static-site.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Lnz3ySTP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/azure-static-site.PNG" alt="Dashboard of the Azure Storage Static Sites"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Building Site
&lt;/h3&gt;

&lt;p&gt;Building the site is done through the &lt;code&gt;mkdocs build&lt;/code&gt; command. This generates a &lt;strong&gt;sites&lt;/strong&gt; directory. MkDocs will give you everything you need for your site, you just need to get those files served up over a web server.&lt;/p&gt;

&lt;p&gt;I just used &lt;a href="https://azure.microsoft.com/en-us/features/storage-explorer/"&gt;Azure Storage Explorer&lt;/a&gt; to upload the generated site directory into Azure Storage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vFxgWtZZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/azure-storage-explorer.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vFxgWtZZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/azure-storage-explorer.PNG" alt="Screenshot of using Azure Storage Explorer to upload files"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In future I'm going to look at how to automate this step so the site can be rebuilt and re-uploaded every time a new version is created (Azure Functions with an Event on the Storage Container possibly).&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding a CDN
&lt;/h3&gt;

&lt;p&gt;Something that caused me a lot of fustration and wasted time was trying to link my domain name to my storage. Ideally I wanted to serve up the contents of my storage straight through the &lt;code&gt;dishy.dev&lt;/code&gt; domain name. I couldn't get the storage serving up over the root domain, it was always on a subdomain.&lt;/p&gt;

&lt;p&gt;In the end I found out that the scenario I was trying to do wasn't possible, and that using a CDN to serve up the storage contents would allow me to quickly link my domain.&lt;/p&gt;

&lt;p&gt;CDN setup can be quite confusing but Microsoft have some &lt;a href="https://docs.microsoft.com/en-us/azure/storage/blobs/static-website-content-delivery-network"&gt;good guidance&lt;/a&gt; on how to do it. Remember to enable &lt;a href="https://docs.microsoft.com/en-gb/azure/cdn/cdn-storage-custom-domain-https#http-to-https-redirection"&gt;http to https redirection&lt;/a&gt; in your CDN rules. And if you want to let people access your site without needing "&lt;a href="http://www."&gt;www.&lt;/a&gt;" at the front &lt;a href="https://arlanblogs.alvarnet.com/adding-a-root-domain-to-azure-cdn-endpoint/"&gt;Arlan Blogs - Adding a Root Domain to Azure CDN Endpoint&lt;/a&gt; has instructions on how to do this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NhRnrBoH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/azure-cdn-http-to-https.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NhRnrBoH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/azure-cdn-http-to-https.PNG" alt="Screenshot of settings for redirecting http to https in Azure CDN"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding Telemetry
&lt;/h3&gt;

&lt;p&gt;In the &lt;code&gt;mkdocs.yml&lt;/code&gt; I added a link to an &lt;a href="https://docs.microsoft.com/en-us/azure/azure-monitor/app/javascript#snippet-based-setup"&gt;Azure Application Insights Snippet&lt;/a&gt; to let me see what sort of traffic the site was generating.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;extra_javascript&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;scripts/application_insights.js'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6ZeBDDnC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/azure-application-insights-page-load.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6ZeBDDnC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.dishy.dev/articles/images/azure-application-insights-page-load.PNG" alt="Azure Application insights page loading statics example"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;And there you have it, not bad for a couple of hours work. A really quick way to stand up a quick site for blogging or documentation.&lt;/p&gt;

&lt;p&gt;MkDocs is very extendable with a lot of &lt;a href="https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins"&gt;plugins&lt;/a&gt; available to easily expand your site. Tagging of your pages, Minifiers for your build etc so there's plenty of scope to build more complex sites.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>python</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
