<?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: Tanmay Naik</title>
    <description>The latest articles on DEV Community by Tanmay Naik (@blazephoenix).</description>
    <link>https://dev.to/blazephoenix</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%2F86288%2Fec0ebb81-917d-487e-8a60-d9bc8ecf691a.jpg</url>
      <title>DEV Community: Tanmay Naik</title>
      <link>https://dev.to/blazephoenix</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/blazephoenix"/>
    <language>en</language>
    <item>
      <title>Manticore 1.0 is released!</title>
      <dc:creator>Tanmay Naik</dc:creator>
      <pubDate>Sun, 19 Apr 2020 13:58:14 +0000</pubDate>
      <link>https://dev.to/blazephoenix/manticore-1-0-is-released-3mg</link>
      <guid>https://dev.to/blazephoenix/manticore-1-0-is-released-3mg</guid>
      <description>&lt;p&gt;Manticore is a simple, minimal static site generator in Python. It's free and open source, and I would appreciate feedback. &lt;/p&gt;

&lt;p&gt;This is my first contribution to open source, looking to make many more. Forks and pull requests, improvements on the codebase are all welcome!&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/blazephoenix"&gt;
        blazephoenix
      &lt;/a&gt; / &lt;a href="https://github.com/blazephoenix/manticore"&gt;
        manticore
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Static site generator in python
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Manticore&lt;/h1&gt;
&lt;p&gt;A simple, minimal static site generator in Python.&lt;/p&gt;
&lt;h2&gt;
Getting Started&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Create a virtual environment - &lt;code&gt;virtualenv venv&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;pip install -r requirements.txt&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add posts in markdown format in the content folder
&lt;ul&gt;
&lt;li&gt;In &lt;code&gt;content/resume&lt;/code&gt; for resume.&lt;/li&gt;
&lt;li&gt;In &lt;code&gt;content/default&lt;/code&gt; for blog posts.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Check commands with &lt;code&gt;python build.py --help&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="snippet-clipboard-content position-relative overflow-auto"&gt;&lt;pre&gt;&lt;code&gt;Usage: build.py [OPTIONS]

Options:
  -d, --default TEXT  Generate the default blog template
  -r, --resume TEXT   Generate a resume template
  --help              Show this message and exit.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;E.g. To generate a blog,
Type &lt;code&gt;python build.py --default default&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An &lt;code&gt;output&lt;/code&gt; folder will be created with the markdown files in &lt;code&gt;content/default&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The directory structure in the &lt;code&gt;output&lt;/code&gt; folder&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="snippet-clipboard-content position-relative overflow-auto"&gt;&lt;pre&gt;&lt;code&gt;\output
 \posts
  home.html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The process is similar but a little easier for generating a resume since it only creates one page.&lt;/p&gt;
&lt;h3&gt;
Prerequisites&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Python 3.6 or higher.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
Deployment&lt;/h2&gt;
&lt;p&gt;Deployment solutions are currently being worked on. Deployment with Netlify CLI could be available in upcoming releases.&lt;/p&gt;
&lt;h2&gt;
Built With&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/trentm/python-markdown2"&gt;Markdown2&lt;/a&gt; - A…&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/blazephoenix/manticore"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


</description>
      <category>showdev</category>
      <category>python</category>
      <category>opensource</category>
    </item>
    <item>
      <title>What are some features that every frontend developer should know how to implement?</title>
      <dc:creator>Tanmay Naik</dc:creator>
      <pubDate>Sun, 19 Apr 2020 06:03:45 +0000</pubDate>
      <link>https://dev.to/blazephoenix/what-are-some-frontend-features-that-every-frontend-developer-should-know-how-to-implement-1o13</link>
      <guid>https://dev.to/blazephoenix/what-are-some-frontend-features-that-every-frontend-developer-should-know-how-to-implement-1o13</guid>
      <description>&lt;p&gt;As the question suggests, what are some frontend features every frontend developer should know how to implement/optimize for, as a standard thing a frontend dev should know? A few things off the top of my head would be,&lt;/p&gt;

&lt;p&gt;Working with APIs to&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Search&lt;/li&gt;
&lt;li&gt;Sort&lt;/li&gt;
&lt;li&gt;Filter&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Optimizing by&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Throttling&lt;/li&gt;
&lt;li&gt;Debouncing&lt;/li&gt;
&lt;li&gt;Memoization &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What else?&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>javascript</category>
      <category>career</category>
      <category>webdev</category>
    </item>
    <item>
      <title>CLI applications in Python with Click</title>
      <dc:creator>Tanmay Naik</dc:creator>
      <pubDate>Wed, 18 Mar 2020 13:11:36 +0000</pubDate>
      <link>https://dev.to/blazephoenix/cli-applications-in-python-with-click-1n4b</link>
      <guid>https://dev.to/blazephoenix/cli-applications-in-python-with-click-1n4b</guid>
      <description>&lt;p&gt;What happens when you're in quarantine and got nothing to do?&lt;/p&gt;

&lt;p&gt;You code, of course. And we are back again with another tutorial-ish article about how to make CLI applications in Python with the &lt;a href="https://github.com/pallets/click"&gt;Click&lt;/a&gt; library. This should be enough to get you started building your own CLI applications using Click.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we'll be making
&lt;/h2&gt;

&lt;p&gt;We'll be making a madlibs program that takes text input and makes a madlib.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    __  ___          _____ __            ________    ____
   /  |/  /___ _____/ / (_) /_  _____   / ____/ /   /  _/
  / /|_/ / __ `/ __  / / / __ \/ ___/  / /   / /    / /  
 / /  / / /_/ / /_/ / / / /_/ (__  )  / /___/ /____/ /   
/_/  /_/\__,_/\__,_/_/_/_.___/____/   \____/_____/___/   


Enter an animal: Flamingo
Enter a food: Hamburger
Enter a city: New Jersey

Once upon a time, deep in an ancient jungle,
there lived a flamingo.  This flamingo
liked to eat hamburger, but the jungle had
very little hamburger to offer.  One day, an
explorer found the flamingo and discovered
it liked hamburger.  The explorer took the
flamingo back to New jersey, where it could
eat as much hamburger as it wanted.  However,
the flamingo became homesick, so the
explorer brought it back to the jungle,
leaving a large supply of hamburger.

The End
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;Before we begin, it's advisable to create a virtual environment. Since this is a very simple application, we are only going to need one python file, not including the virtual environment. We will be using Click for the CLI and pyFiglet for that fancy ASCII lettering. You can install them by using pip with your virtual environment active,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install Click, pyfiglet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;In the same directory, create a new file called madlibs.py and paste the following code,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import click
from pyfiglet import Figlet

f = Figlet(font='slant')
print(f.renderText("Madlibs CLI"))

@click.command()
@click.option('--animal', prompt='Enter an animal', help='Name of an animal')
@click.option('--food', prompt='Enter a food', help='Name of a food')
@click.option('--city', prompt='Enter a city', help='Name of a city')
def madlibs(animal, food, city):
    '''
    A CLI application that takes the name of an animal, food and place to make up a madlib.
    '''
    story = f"""
Once upon a time, deep in an ancient jungle,
there lived a {animal.lower()}.  This {animal.lower()}
liked to eat {food.lower()}, but the jungle had
very little {food.lower()} to offer.  One day, an
explorer found the {animal.lower()} and discovered
it liked {food.lower()}.  The explorer took the
{animal.lower()} back to {city.capitalize()}, where it could
eat as much {food.lower()} as it wanted.  However,
the {animal.lower()} became homesick, so the
explorer brought it back to the jungle,
leaving a large supply of {food.lower()}.

The End
            """

    click.echo(story)


if __name__ == "__main__":
    madlibs()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  What's happening here?
&lt;/h2&gt;

&lt;p&gt;The first two lines import each of the packages. &lt;/p&gt;

&lt;p&gt;Click is based on declaring commands through decorators. Here, &lt;code&gt;@click.command()&lt;/code&gt; is the decorator which converts a function into a command line tool. To put it simply, &lt;code&gt;@click.command()&lt;/code&gt; turns the function &lt;code&gt;madlibs()&lt;/code&gt; into a callable script. You can try doing,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@click.command()
def madlibs():
    click.echo('Madlibs!')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;And it will print out the statement on the console by invoking the function as a command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;@click.option()&lt;/code&gt; is used to pass optional parameters to the function. In this case, we are passing the names of an animal, food and city. The good thing about Click is that it automatically generates help text for you, and it's easily customizable. As you can see here,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@click.option('--animal', prompt='Enter an animal', help='Name of an animal')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;and the script description added within the function,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def madlibs(animal, food, city):
    '''
    A CLI application that takes the name of an animal, food and place to make up a madlib.
    '''
    .
    .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If you type &lt;code&gt;python madlibs.py --help&lt;/code&gt;, you will be shown the following,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    __  ___          _____ __            ________    ____
   /  |/  /___ _____/ / (_) /_  _____   / ____/ /   /  _/
  / /|_/ / __ `/ __  / / / __ \/ ___/  / /   / /    / /
 / /  / / /_/ / /_/ / / / /_/ (__  )  / /___/ /____/ /
/_/  /_/\__,_/\__,_/_/_/_.___/____/   \____/_____/___/


Usage: madlibs.py [OPTIONS]

  A CLI application that takes the name of an animal, food and place to make
  up a madlib.

Options:
  --animal TEXT  Name of an animal
  --food TEXT    Name of a food
  --city TEXT    Name of a city
  --help         Show this message and exit.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Neat, huh!&lt;/p&gt;

&lt;p&gt;It is advised to use &lt;code&gt;setuptools&lt;/code&gt; if you plan on sharing it as a proper CLI application. Read more on setuptools integration in the &lt;a href="https://click.palletsprojects.com/en/7.x/setuptools/#setuptools-integration"&gt;official docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Until next time.&lt;/p&gt;

&lt;p&gt;TL;DR to the code,&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/blazephoenix"&gt;
        blazephoenix
      &lt;/a&gt; / &lt;a href="https://github.com/blazephoenix/python-cli-apps"&gt;
        python-cli-apps
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A bunch of CLI apps made with Python 3
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>python</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>How do you debug your fullstack web apps?</title>
      <dc:creator>Tanmay Naik</dc:creator>
      <pubDate>Mon, 30 Dec 2019 19:17:35 +0000</pubDate>
      <link>https://dev.to/blazephoenix/how-do-you-debug-your-fullstack-web-apps-cbl</link>
      <guid>https://dev.to/blazephoenix/how-do-you-debug-your-fullstack-web-apps-cbl</guid>
      <description></description>
      <category>discuss</category>
      <category>webdev</category>
      <category>python</category>
      <category>database</category>
    </item>
    <item>
      <title>Consuming an API in Svelte</title>
      <dc:creator>Tanmay Naik</dc:creator>
      <pubDate>Sun, 22 Dec 2019 21:10:22 +0000</pubDate>
      <link>https://dev.to/blazephoenix/consuming-an-api-in-svelte-5181</link>
      <guid>https://dev.to/blazephoenix/consuming-an-api-in-svelte-5181</guid>
      <description>&lt;p&gt;I'd been figuring out Svelte since a week now and saying that I've fallen in love with it would be an understatement. Everything is so much faster to do and easier to understand that you'll probably see me becoming an unofficial evangelist for it. To be honest, React was difficult for me to grasp and it took me atleast a month of trying it out on and off before I was comfortable with it. It was only after the introduction of hooks that I was able to use it better. With Svelte though, here I am writing an article about it after fiddling with it for just over a week!&lt;/p&gt;

&lt;p&gt;Without further ado, here we go!&lt;/p&gt;

&lt;h1&gt;
  
  
  Installation
&lt;/h1&gt;

&lt;p&gt;Assuming you have Node installed on your system, enter the following in your command line,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx degit sveltejs/template numberfacts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This uses the template from the official Svelte repository on Github and provides us with a ready to use Hello World project. Once that is done, &lt;code&gt;cd&lt;/code&gt; into your directory and run &lt;code&gt;npm install&lt;/code&gt;. It should install all the packages that Svelte needs to run your project. If you followed it right, &lt;code&gt;npm run dev&lt;/code&gt; should serve your project up on localhost:5000.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fjqw1hzw6tm6kms5v7e31.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fjqw1hzw6tm6kms5v7e31.png" alt="Svelte Hello World"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  What we're making
&lt;/h1&gt;

&lt;p&gt;We'll be using the &lt;a href="http://numberapi.com" rel="noopener noreferrer"&gt;Numbers API&lt;/a&gt; as our endpoint to generate random facts about any number our user enters.&lt;/p&gt;
&lt;h1&gt;
  
  
  Overview
&lt;/h1&gt;

&lt;p&gt;This is what our directory structure looks like -&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node_modules
public
src
--app.svelte
--main.js
package.json
package-lock.json
README.md
rollup.config.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;I ignored the contents of the folders and have only focused on the ones we will be working with. In the &lt;code&gt;main.js&lt;/code&gt; file, remove the &lt;code&gt;props: 'World'&lt;/code&gt; part and replace the contents of the &lt;code&gt;App.svelte&lt;/code&gt; file with the following code,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script&amp;gt;
    let query = "";
    let result;

    async function getResult() {

        let response = await fetch(`http://numbersapi.com/${query}`);
        let text = await response.text();
        let data = text;
        return data;
    }

    function submitHandler(e) {
        result = getResult();
    }
&amp;lt;/script&amp;gt;

&amp;lt;div class="container mt-5"&amp;gt;
    &amp;lt;div class="row"&amp;gt;
        &amp;lt;div class="col-md"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="col-md-8 text-center"&amp;gt;
            &amp;lt;h1 class="display-4"&amp;gt;Random Number Facts&amp;lt;/h1&amp;gt;
            &amp;lt;form class="form-inline" on:submit|preventDefault={submitHandler}&amp;gt;
                &amp;lt;input class="w-75 form-control" type="number" bind:value={query}&amp;gt;
                &amp;lt;button class="w-25 btn btn-dark"&amp;gt;Submit&amp;lt;/button&amp;gt;
            &amp;lt;/form&amp;gt;

            {#if result===undefined}

            &amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;

            {:else}

            {#await result}

            &amp;lt;p&amp;gt;Loading...&amp;lt;/p&amp;gt;

            {:then value}

            {value}

            {:catch error}

            {error.message}

            {/await}

            {/if}
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="col-md"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  What is happening here?
&lt;/h2&gt;

&lt;p&gt;In Svelte, an application is composed from one or more components. A component is a reusable self-contained block of code that encapsulates HTML, CSS and JavaScript that belong together, written into a &lt;code&gt;.svelte&lt;/code&gt; file. The 'hello world' example we currently have is a simple component.&lt;/p&gt;

&lt;p&gt;In the code above, we are only using HTML and Javascript and letting Bootstrap take care of the CSS for us.&lt;/p&gt;

&lt;p&gt;We initialize a &lt;code&gt;query&lt;/code&gt; string which we bind to the value of input using &lt;code&gt;bind:value={query}&lt;/code&gt;. The curly brackets indicate that we are using JS variables inside HTML. Next, we declare a &lt;code&gt;result&lt;/code&gt; variable that will store the result of our request when we send it.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;onSubmitHandler()&lt;/code&gt; runs when the user enters a number in the input. We assign the return value of &lt;code&gt;getResult()&lt;/code&gt; to &lt;code&gt;result&lt;/code&gt; here. &lt;code&gt;getResult()&lt;/code&gt; performs an async fetch request and returns the response.&lt;/p&gt;

&lt;p&gt;On to the HTML part, Svelte provides a lot of functionality out of the box which is very helpful. The &lt;code&gt;on:submit&lt;/code&gt; directive is the Svelte version of the event listener in Javascript. We assign it the &lt;code&gt;onSubmitHandler()&lt;/code&gt; function when the user presses 'Submit'.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;{#await}&lt;/code&gt;,&lt;code&gt;{:then}&lt;/code&gt; and &lt;code&gt;{:catch}&lt;/code&gt; blocks are used to resolve promises on the rendered component. The &lt;code&gt;{#if}&lt;/code&gt; &lt;code&gt;{:else}&lt;/code&gt; block as you may have guessed is a conditional block.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating a Card component
&lt;/h2&gt;

&lt;p&gt;Next, we will create a new component that will render the content we get from the fetch request. Create a new file in the same directory and call it &lt;code&gt;Card.svelte&lt;/code&gt;. Add the following code in &lt;code&gt;Card.svelte&lt;/code&gt;,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script&amp;gt;
export let data;
&amp;lt;/script&amp;gt;

&amp;lt;div class="card mt-5"&amp;gt;
    &amp;lt;div class="card-body"&amp;gt;
        &amp;lt;h5 class="card-title"&amp;gt;{data}&amp;lt;/h5&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This one is pretty small. Here we simply write how we want our card to look like and where we want the rendered data to be. We use &lt;code&gt;export let data&lt;/code&gt; to let our main &lt;code&gt;App.svelte&lt;/code&gt; component use this variable to pass props down to our card. The syntax is a little weird in places, but you will get used to it. Just remember that Svelte is not Javascript. It's a compiler for Javascript which builds to vanilla Javascript in production.&lt;/p&gt;

&lt;p&gt;Now, we have to make some changes in our &lt;code&gt;App.svelte&lt;/code&gt; component to render our card. First, add this line in the script tag on top,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Card from './Card.svelte';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now we can add the card component as an HTML tag and pass down the result of our request to it as a prop, like so,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{#if result===undefined}

 &amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;

{:else}

&amp;lt;p&amp;gt;Loading...&amp;lt;/p&amp;gt;

{#await result}

{:then value}

 &amp;lt;Card data={value} /&amp;gt;

{:catch error}

 &amp;lt;Card data={error.message}/&amp;gt;

{/await}

{/if}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Aand, that's pretty much it! You should be able to enter a number and have a result rendered on your screen. There are other minor things you can do, such as clearing the input field once a number is entered and adding a spinner instead of the loading p tag that we have right now. Svelte provides some &lt;a href="https://svelte.dev/docs#svelte_transition" rel="noopener noreferrer"&gt;animations and transitions&lt;/a&gt; out of the box too!&lt;/p&gt;

&lt;p&gt;TL;DR Take me to the code:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/blazephoenix" rel="noopener noreferrer"&gt;
        blazephoenix
      &lt;/a&gt; / &lt;a href="https://github.com/blazephoenix/numbersapi" rel="noopener noreferrer"&gt;
        numbersapi
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      API consumption with Svelte
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>svelte</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Why learning to program is like owning a dog (in some ways)</title>
      <dc:creator>Tanmay Naik</dc:creator>
      <pubDate>Fri, 06 Dec 2019 13:37:53 +0000</pubDate>
      <link>https://dev.to/blazephoenix/why-learning-to-program-is-like-owning-a-dog-in-some-ways-1fbn</link>
      <guid>https://dev.to/blazephoenix/why-learning-to-program-is-like-owning-a-dog-in-some-ways-1fbn</guid>
      <description>&lt;p&gt;So I just recently got a White German Shepherd pup, and within a few days of being with him, I've come to realize that owning a dog is not an easy thing. But then, neither is programming. So here are some parallels I drew from that. Just a fun post :)&lt;/p&gt;

&lt;h1&gt;
  
  
  You don't know whether you can do it
&lt;/h1&gt;

&lt;p&gt;My first language was JavaScript, and when I started to learn, I had no idea whether I could make a website. My motivation didn't matter because.. motivation only gets you started. It's the same with owning a dog, you don't know if you can own and care for one, but you want one, so you get a dog. And then you are clueless about what to do next.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/xkvttzvWDPMEEXAJB1/source.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xkvttzvWDPMEEXAJB1/source.gif" alt="" width="478" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  You have to take it one day at a time
&lt;/h1&gt;

&lt;p&gt;Owning a dog is a lot of responsibility. And if you think of the big picture, you can end up scaring yourself shitless. There's a lot to learn on how to discipline your dog, what to buy, when to vaccinate, vet schedules, and so on. It's the same with programming, there is a whole lot to learn with no end in sight. So, it's important to know that at this point, you don't need to learn everything on day one.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rCtowmMI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media1.giphy.com/media/8YHtCyo0hT7ThZSsnN/giphy.gif%3Fcid%3D19f5b51a7492d4b5cecc60a446512c87f066c74617c382d2%26rid%3Dgiphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rCtowmMI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media1.giphy.com/media/8YHtCyo0hT7ThZSsnN/giphy.gif%3Fcid%3D19f5b51a7492d4b5cecc60a446512c87f066c74617c382d2%26rid%3Dgiphy.gif" alt="" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  You can't ignore the ugly parts
&lt;/h1&gt;

&lt;p&gt;Programming is a mentally stimulating activity where you get to learn new things all the time. And we all have a preference for a particular part of it, frontend, backend, fullstack, database, application development, these are just the broader parts of it. And you can go even deeper than that in terms of job titles. But even then, sometimes a part of your job will require you to have some idea of the others too, even if you don't like to do them. Owning a dog means you get to play with it, pet it, go out on walks, have a furry companion who would trust you with their eyes closed, but it also means having to clean up after them, regular vet visits, partly chewed furniture, and so on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/3Mi9k7Y5gHMmZv0lin/source.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3Mi9k7Y5gHMmZv0lin/source.gif" alt="" width="700" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  You can't slack off
&lt;/h1&gt;

&lt;p&gt;That said, programming is a very demanding field where you have to always keep abreast of the happenings. I remember not coding for about half a year and feeling like a complete newbie because Angular was replaced by React and you could suddenly make apps with web technologies. Your dog is also very demanding by nature, you have to be alert at all times so he doesn't do something you wouldn't want him to, like poop on the carpet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--53u6EdbR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media0.giphy.com/media/lcdMStZJGXPSmu8a5c/giphy.gif%3Fcid%3D19f5b51a066254358a2b81fb91f7d0b3dd7f374a30e19482%26rid%3Dgiphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--53u6EdbR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media0.giphy.com/media/lcdMStZJGXPSmu8a5c/giphy.gif%3Fcid%3D19f5b51a066254358a2b81fb91f7d0b3dd7f374a30e19482%26rid%3Dgiphy.gif" alt="" width="480" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Inspite of everything, it's fun and you love it
&lt;/h1&gt;

&lt;p&gt;At the end of the day though, it's still a lot of fun to make things and to have a furball to play with after an eventful day, and you wouldn't want it any other way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fc0Gpeig--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media0.giphy.com/media/s2qXK8wAvkHTO/giphy.gif%3Fcid%3D19f5b51a5f3b2af874dad4f18477d4da7a186008681223c7%26rid%3Dgiphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fc0Gpeig--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media0.giphy.com/media/s2qXK8wAvkHTO/giphy.gif%3Fcid%3D19f5b51a5f3b2af874dad4f18477d4da7a186008681223c7%26rid%3Dgiphy.gif" alt="" width="252" height="166"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's all folks!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>web</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Implementing Flexbox with SCSS mixins </title>
      <dc:creator>Tanmay Naik</dc:creator>
      <pubDate>Thu, 03 Oct 2019 11:51:35 +0000</pubDate>
      <link>https://dev.to/blazephoenix/flexing-with-scss-mixins-2ke9</link>
      <guid>https://dev.to/blazephoenix/flexing-with-scss-mixins-2ke9</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.pexels.com%2Fphotos%2F160107%2Fpexels-photo-160107.jpeg%3Fauto%3Dcompress%26cs%3Dtinysrgb%26dpr%3D2%26h%3D650%26w%3D940" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.pexels.com%2Fphotos%2F160107%2Fpexels-photo-160107.jpeg%3Fauto%3Dcompress%26cs%3Dtinysrgb%26dpr%3D2%26h%3D650%26w%3D940" alt="CSS and HTML"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was scouring the internet for a good mixin for flexbox but I would always come across mixins like these,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@mixin flexbox() {
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;with a mixin for every possible property,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@mixin justify-content($justify) {
  -webkit-justify-content: $justify;
     -moz-justify-content: $justify;
      -ms-justify-content: $justify;
          justify-content: $justify;
            -ms-flex-pack: $justify;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;While this may work for a lot of people, I still felt that it could be made simpler, or "DRY'er". I'm pretty sure someone must have done something like this before, but I couldn't find it. So after a little bit of struggling around with SCSS mixins and functions, I came up with this,&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;More functions can be created and extended into the mixin such as flex-direction, flex-wrap, flex-grow, etc. with the &lt;a class="mentioned-user" href="https://dev.to/content"&gt;@content&lt;/a&gt; directive in a similar way. It can also be used on properties that use the same values like justify-self or align-self. I will be updating this post with a github repo for all the functions and mixins soon.&lt;/p&gt;




&lt;p&gt;Would love to know if anyone finds it useful. Thanks.&lt;/p&gt;

</description>
      <category>css</category>
      <category>scss</category>
      <category>sass</category>
      <category>flexbox</category>
    </item>
    <item>
      <title>How to find the motivation to blog?</title>
      <dc:creator>Tanmay Naik</dc:creator>
      <pubDate>Wed, 18 Sep 2019 18:49:44 +0000</pubDate>
      <link>https://dev.to/blazephoenix/how-to-find-the-motivation-to-blog-ddj</link>
      <guid>https://dev.to/blazephoenix/how-to-find-the-motivation-to-blog-ddj</guid>
      <description>&lt;p&gt;Also, given the motivation, how do you plan your posts?&lt;/p&gt;

</description>
      <category>blog</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Node JS Help</title>
      <dc:creator>Tanmay Naik</dc:creator>
      <pubDate>Mon, 09 Sep 2019 11:23:09 +0000</pubDate>
      <link>https://dev.to/blazephoenix/node-js-help-540i</link>
      <guid>https://dev.to/blazephoenix/node-js-help-540i</guid>
      <description>&lt;p&gt;I'm working on a portfolio template that uses a local JSON file that has an object with the name, links and email address, to load data and manipulate the DOM accordingly.&lt;/p&gt;

&lt;p&gt;The issue I have is that, it only runs on the server and not on the client side. I'm using the Fetch API and I discovered that it does not allow loading of JSON locally without a server for security reasons. I know I can use Node to run a server, pass the data to client side JS and manipulate the DOM. But the problem is that I want the eventual site to be static and the changes to be persistent, which they are not.&lt;/p&gt;

&lt;p&gt;Is there a way to run the server script to simply pass the JSON to client side and then shut it down and have the changes stay permanent? Or am I using the wrong tool to do this?&lt;/p&gt;

</description>
      <category>help</category>
      <category>node</category>
      <category>api</category>
    </item>
    <item>
      <title>Social Media Card UI</title>
      <dc:creator>Tanmay Naik</dc:creator>
      <pubDate>Thu, 05 Sep 2019 17:44:03 +0000</pubDate>
      <link>https://dev.to/blazephoenix/social-media-card-ui-5c1o</link>
      <guid>https://dev.to/blazephoenix/social-media-card-ui-5c1o</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Blazephoenix_/embed/VwZyeoE?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
      <category>html</category>
      <category>css</category>
      <category>cardui</category>
    </item>
    <item>
      <title>Minimis - The portal to your web footprint</title>
      <dc:creator>Tanmay Naik</dc:creator>
      <pubDate>Wed, 04 Sep 2019 12:59:21 +0000</pubDate>
      <link>https://dev.to/blazephoenix/minimis-the-portal-to-your-web-footprint-1i0c</link>
      <guid>https://dev.to/blazephoenix/minimis-the-portal-to-your-web-footprint-1i0c</guid>
      <description>&lt;p&gt;Minimis is a Latin word for 'minimal', which was kept in mind when designing this template. It essentially acts as a portal to your web footprint in a professional capacity. A lot of times, writing a blog and being consistent with it is generally not feasible to every developer or designer out there. And sites like Medium, and dev.to as well, have made having a personal blog kind of pointless to a large degree.&lt;/p&gt;

&lt;p&gt;So I created &lt;a href="https://github.com/Blazephoenix/minimis"&gt;Minimis&lt;/a&gt; with an intent to have a decent looking single page website as a gateway to all your other profiles that you could show a potential employer or a client.&lt;/p&gt;

&lt;p&gt;Here's a live demo of my own website using it - &lt;a href="https://blazephoenix.github.io"&gt;blazephoenix.github.io&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Would love some feedback on it. Thanks!&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>javascript</category>
      <category>career</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Webscraping in Python with Flask and BeautifulSoup 4</title>
      <dc:creator>Tanmay Naik</dc:creator>
      <pubDate>Tue, 05 Feb 2019 18:19:13 +0000</pubDate>
      <link>https://dev.to/blazephoenix/webscraping-in-python-with-flask-and-beautifulsoup-4-1pkl</link>
      <guid>https://dev.to/blazephoenix/webscraping-in-python-with-flask-and-beautifulsoup-4-1pkl</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvlb3nw2civ5iyd3ats4w.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvlb3nw2civ5iyd3ats4w.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is web scraping?
&lt;/h2&gt;

&lt;p&gt;Web scraping is a term used for the process of extracting HTML/XML data from websites. Once extracted, it can be parsed into a different HTML file or saved locally in text/spreadsheet documents.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who does it?
&lt;/h2&gt;

&lt;p&gt;A lot of websites that aggregate data from other websites on the internet. Some examples could be websites that give you the best deals on the same product after comparing across multiple platforms (Amazon, Flipkart, Ebay, etc.), and also sites that collect datasets to apply ML algorithms to.&lt;/p&gt;

&lt;h2&gt;
  
  
  How is it useful to me?
&lt;/h2&gt;

&lt;p&gt;I would recommend you to limit your thinking to how something could benefit you especially when you know little to nothing about it. It helps to be a generalist when you’re just starting out. Learn everything, you never know when you’ll need it! You can always settle and specialize in one area eventually, when you’re well aware of the options you have.&lt;/p&gt;




&lt;h2&gt;
  
  
  What we’ll need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Python v3.6.8&lt;/li&gt;
&lt;li&gt;VSCode&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installing Python (skip if already installed)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Go to — python.org &amp;gt; Downloads &amp;gt; Windows&lt;/li&gt;
&lt;li&gt;Scroll to version 3.6.8 &amp;gt; x86 (32 bit) / x86–64 (64 bit) &amp;gt; Executable&lt;/li&gt;
&lt;li&gt;Double-click and check “Add Python to PATH”&lt;/li&gt;
&lt;li&gt;Follow the installation instructions.&lt;/li&gt;
&lt;li&gt;Check if correctly installed&lt;/li&gt;
&lt;li&gt;Press Windows key+R &amp;gt; Type “cmd” to open the command line.&lt;/li&gt;
&lt;li&gt;In the command line &amp;gt; Type,&lt;/li&gt;
&lt;li&gt;python --version&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If Python is installed correctly, you should see, &lt;code&gt;3.6.8&lt;/code&gt; in the terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing VSCode (skip if already installed)
&lt;/h2&gt;

&lt;p&gt;VSCode is a free code editor with lots of features that make writing and debugging code much easier.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to code.visualstudio.com &amp;gt; Download for Windows &amp;gt; x86/x64 &amp;gt; Installer.&lt;/li&gt;
&lt;li&gt;Double-click and follow the instructions.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Let’s begin!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Create a new folder and call it “Webscraper”&lt;/li&gt;
&lt;li&gt;Inside the folder, create a new file named webscraper.py&lt;/li&gt;
&lt;li&gt;Open VSCode &amp;gt; File &amp;gt; Open Folder &amp;gt; Navigate to “Webscraper”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now we need to import a few libraries which will help us build our web scraper.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to Terminal &amp;gt; New Terminal&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is basically the command line but within the editor so we don’t have to have two windows and keep switching between them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next we call &lt;code&gt;pip&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;You could call it the Alfred to Python’s Batman. Hehe.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In your terminal, type &lt;code&gt;pip install beautifulsoup4&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;This installs the beautifulsoup library which will help us scrape webpages.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next type &lt;code&gt;pip install flask&lt;/code&gt; and &lt;code&gt;pip install requests&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Flask is a lightweight framework to build websites. We’ll use this to parse our collected data and display it as HTML in a new HTML file.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The requests module allows us to send http requests to the website we want to scrape.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In your file, type the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    from flask import Flask, render_template
    from bs4 import BeautifulSoup
    import requests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;The first line imports the Flask class and the render_template method from the flask library. The second line imports the BeautifulSoup class, and the third line imports the requests module from our Python library.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Next, we declare a variable which will hold the result of our request&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    source = requests.get(‘https://webscraper.droppages.com/').text
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We send a &lt;code&gt;GET&lt;/code&gt; request to &lt;a href="https://webscraper.droppages.com" rel="noopener noreferrer"&gt;https://webscraper.droppages.com&lt;/a&gt; and convert the HTML to plain text and store that in the &lt;code&gt;source&lt;/code&gt; variable.&lt;/p&gt;

&lt;p&gt;Next we declare a &lt;code&gt;soup&lt;/code&gt; variable and store the value we get after passing &lt;code&gt;source&lt;/code&gt; to &lt;code&gt;BS&lt;/code&gt;. ‘lxml’ is the markup we want our rendered code to have.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    soup = BeautifulSoup(source, 'lxml')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, we have our code working. You can check it out by passing soup to a print function, like this &lt;code&gt;print(soup)&lt;/code&gt; after the previous line and running &lt;code&gt;python webscraper.py&lt;/code&gt; in the terminal.&lt;/p&gt;




&lt;p&gt;Right now, we are pulling the entire web page rather than specific elements on it. To get specific elements, you can try these by yourself.&lt;/p&gt;

&lt;p&gt;But before you do that, you should be aware of what exactly you want to get. You can either run the last command again or open the web page in the browser and inspect it by right clicking on the page. Some knowledge of HTML DOM and CSS is required here. You can head over to &lt;a href="https://www.w3schools.com" rel="noopener noreferrer"&gt;W3Schools&lt;/a&gt; or &lt;a href="https://developer.mozilla.org/en-US" rel="noopener noreferrer"&gt;MDN&lt;/a&gt; for a quick crash course on both.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    &amp;lt;variable&amp;gt; = soup.find('&amp;lt;HTML_element_name&amp;gt;')
    &amp;lt;variable&amp;gt; = soup.find('&amp;lt;HTML_element_name&amp;gt;').select_one('child_element')
    &amp;lt;variable&amp;gt; = soup.find('&amp;lt;HTML_element_name&amp;gt;').find_all('child_element')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;You can pass regular CSS notation in the brackets to be more specific about the elements you want.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now, we are only actually just outputting HTML along with the text inside it. What if we just want the text?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That’s easy.&lt;/p&gt;

&lt;p&gt;We simply pass &lt;code&gt;.text&lt;/code&gt; at the end of it. Just like we did with &lt;code&gt;source&lt;/code&gt;. Here’s an example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    head = soup.find(‘main’).select_one(‘article:nth-of-type(4)’).div.text
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Here, we tell Python to store the text of the div in the 4th article element which is in the main element, in the head variable.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can check the output by passing head to &lt;code&gt;print()&lt;/code&gt; and running &lt;code&gt;python webscraper.py&lt;/code&gt; in the terminal.&lt;/p&gt;

&lt;p&gt;Try getting the names of one of the authors if you can.&lt;/p&gt;




&lt;p&gt;You can get an author like this,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    author = soup.find(‘main’).select_one(‘p’).text
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Notice how you also get the date along with the name. That’s because both of them share the same element. There is a way to get the author name separately by using Python string methods like &lt;code&gt;split&lt;/code&gt; and &lt;code&gt;slice&lt;/code&gt;. But we won’t cover that here.&lt;/p&gt;




&lt;p&gt;Next up, we will use flask to re-render our received data the way we want on a local server.&lt;/p&gt;

&lt;p&gt;In your file, type the following code,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    app = Flask(__name__)
    @app.route('/')
    def index():
       return render_template('index.html,**locals())
    app.run(debug=True)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a new templates folder in your main webscraper folder and call it &lt;code&gt;index.html&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The flask part is a little complicated to explain but to put it simply, we created a simple server that will take our &lt;code&gt;index.html&lt;/code&gt; from the templates folder and serve it on a local server — &lt;code&gt; localhost://5000&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, we can combine multiple variables we declared in all the previous code using soup and pass the text to our HTML and use CSS to style them the way we want!&lt;/p&gt;

&lt;p&gt;You can use this code for the &lt;code&gt;index.html&lt;/code&gt; file,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    &amp;lt;!DOCTYPE html&amp;gt;
    &amp;lt;html lang=”en”&amp;gt;
     &amp;lt;head&amp;gt;
      &amp;lt;meta charset=”UTF-8"&amp;gt;
      &amp;lt;meta name=”viewport” content=”width=device-width, initial-scale=1.0"&amp;gt;
      &amp;lt;meta http-equiv=”X-UA-Compatible” content=”ie=edge”&amp;gt;
      &amp;lt;title&amp;gt;Webscraper in Python using Flask&amp;lt;/title&amp;gt;
     &amp;lt;/head&amp;gt;
     &amp;lt;body&amp;gt;
      &amp;lt;!-- Variables from Flask here --&amp;gt;
     &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we can use all the code we learned so far to create custom variables and pull specific data from our site. If we are well versed with the structure of our target site, we can use shortcuts like these.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    head = soup.header.h1.text

    second_author = soup.main.select_one(‘article:nth-of-type(2)’).p.text

    first_article = soup.main.article.div
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Type these inside the &lt;code&gt;index()&lt;/code&gt; function that we created, just above the return statement.&lt;/li&gt;
&lt;li&gt;Save the file&lt;/li&gt;
&lt;li&gt;Go to index.html&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now we’ll pass these variables into our HTML while it gets rendered so we can see the data on our webpage.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    &amp;lt;!DOCTYPE html&amp;gt;
    &amp;lt;html lang=”en”&amp;gt;
     &amp;lt;head&amp;gt;
      &amp;lt;meta charset=”UTF-8"&amp;gt;
      &amp;lt;meta name=”viewport” content=”width=device-width, initial-scale=1.0"&amp;gt;
      &amp;lt;meta http-equiv=”X-UA-Compatible” content=”ie=edge”&amp;gt;
      &amp;lt;title&amp;gt;Webscraper in Python using Flask&amp;lt;/title&amp;gt;
     &amp;lt;/head&amp;gt;
     &amp;lt;body&amp;gt;
      &amp;lt;h1&amp;gt;{{ head }}&amp;lt;/div&amp;gt;
      &amp;lt;p&amp;gt;{{ second_author }}&amp;lt;/p&amp;gt;
      &amp;lt;article&amp;gt;{{ first_article }}&amp;lt;/article&amp;gt;
     &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now open the terminal and run &lt;code&gt;python webscraper.py&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Aand we did it!
&lt;/h3&gt;

&lt;p&gt;If you’re wondering how it’s so easy, well, it’s not. This was just a single page, and a simple one at that, with no classes or IDs added to the HTML. But this is a good start.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wonder how you can scrape multiple pages?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The answer is multiple &lt;code&gt;for&lt;/code&gt;, &lt;code&gt;while&lt;/code&gt;, &lt;code&gt;try&lt;/code&gt;, &lt;code&gt;except&lt;/code&gt; and &lt;code&gt;if-else&lt;/code&gt; loops!&lt;/p&gt;




&lt;p&gt;Hello, this was my very first technical article. If you find any errors in the code or the way I approached the tutorial, feel free to correct me. I'm excited to be part of this community as I grow with it and intend to contribute meaningful content. Thank you for reading!&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>beautifulsoup4</category>
      <category>webscraping</category>
    </item>
  </channel>
</rss>
