<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Eko Misprajiko on Medium]]></title>
        <description><![CDATA[Stories by Eko Misprajiko on Medium]]></description>
        <link>https://medium.com/@ekomisprajiko?source=rss-ffd20f8a35cf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*-wpwZ3Z884zxelk5mdU3Bw.jpeg</url>
            <title>Stories by Eko Misprajiko on Medium</title>
            <link>https://medium.com/@ekomisprajiko?source=rss-ffd20f8a35cf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 21:56:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ekomisprajiko/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Share The PyCharm Project on Github]]></title>
            <link>https://medium.com/analytics-vidhya/how-to-share-the-pycharm-project-on-github-de837063c12?source=rss-ffd20f8a35cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/de837063c12</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[pycharm]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Eko Misprajiko]]></dc:creator>
            <pubDate>Tue, 31 Mar 2020 08:25:34 GMT</pubDate>
            <atom:updated>2020-03-31T12:55:46.303Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>A simple way to share your project on GitHub using PyCharm</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nKQqy0DKhVt_C_p_2dkOXQ.jpeg" /><figcaption>How to Share The PyCharm Project on Github</figcaption></figure><p>In this article I will tell you about <strong>How to share The PyCharm Project on GitHub</strong>.</p><p>If you don’t know what GitHub is, please read a little of my explanation about GitHub below. However, if you already understand and just want to know how to share your Pycharm Project on GitHub, then please skip this section and keep scrolling down until you find what you are looking for. Then, if you don’t find what you’re looking for, chances are you’ve lost. <em>lol</em></p><p>Okay, <strong>what is GitHub</strong>?</p><blockquote>“<strong>GitHub, Inc.</strong> is a US-based global company that provides hosting for software development version control using Git. It is a subsidiary of Microsoft, which acquired the company in 2018 for US$7.5 billion. It offers the distributed version control and source code management functionality of Git, plus its own features.” <a href="https://en.wikipedia.org/wiki/GitHub"><strong>Wikipedia</strong></a></blockquote><p>In the definition of GitHub above it is mentioned that GitHub uses Git.<br>Hmm … Then, <strong>what is Git</strong>?</p><blockquote>“<strong>Git</strong> is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows.” <a href="https://en.wikipedia.org/wiki/Git"><strong>Wikipedia</strong></a></blockquote><p>After you know the meaning of GitHub and Git, maybe you will think <strong>why bother with sharing to GitHub?</strong></p><p>OK, <strong>some reasons you have to upload your project to GitHub</strong>:</p><ol><li><strong>Reduce hard drive memory on personal laptops</strong>. When we work on a project it is not uncommon that the project is just lying on a laptop which may take a long time for us to open the project. Instead of fulfilling the hard drive project, we better save it to GitHub, right? After all, the capacity provided by GitHub is quite large. For GitHub capacity management you can see it <a href="https://help.github.com/en/github/managing-large-files/what-is-my-disk-quota"><strong><em>here</em></strong></a>.</li><li><strong>The project that you created can be big on its own</strong>. Many people are looking for free projects on GitHub, and if that person considers your project interesting, it’s not that he or she will be a contributor to developing your project.</li><li><strong>You will develop your project with the team</strong>. With GitHub you will be easier to manage the division of tasks. Please learn more by browsing the internet.</li><li><strong>Projects that you share on GitHub can become your portfolio</strong>. If you are a student who, when you graduate, wants to work in a company or become a freelancer, then you can show the project that you have saved on GitHub as your portfolio. Surely you will have more value right?</li></ol><p>Mmm … maybe there are still many more reasons to share the project with GitHub, but the article might be too long and does not reach the core of <strong>how to share the PyCharm project on GitHub</strong>.</p><p><em>This is too long. lol</em></p><p><em>Okay let’s practice!</em><br>As usual, there are a number of preparations you must make before moving on to <strong>how to share the PyCharm project on GitHub</strong>:</p><ol><li>Of course <strong>you should already have a PyCharm project first</strong>. If you don’t have a project, you can use the project in the article <a href="https://medium.com/@ekomisprajiko/how-to-master-web-scraping-using-python-in-less-than-30-minutes-2bdb0bd1048c"><strong><em>How to Master Web Scraping using Python in less than 30 minutes</em></strong></a>. I also used the project in this article. <em>But I do not recommend you to download it directly from my GitHub, because there are already a number of files that will actually be created in this article.</em></li><li><strong>You must already have a GitHub account</strong>. If you don’t have a GitHub account, please register first <a href="https://github.com/"><strong><em>here</em></strong></a>.</li></ol><p>Yes, that’s all the preparation. If you already have everything I mentioned above then <strong>you can start the steps to share the PyCharm Project on GitHub</strong>.</p><p><em>Come on coding now!</em><br><strong>FIRST STAGE — CREATE .gitignore FILE</strong><br>The .gitignore file serves <em>to ignore some things that we don’t need to save or push into GitHub</em>. <strong>Why?</strong> Because not everyone uses PyCharm as an IDE to build applications in Python, so we don’t need to save files and folders like .idea, venv, etc. on GitHub. It also can reduce our storage capacity on GitHub. Following are the steps to create a .gitignore file using PyCharm:</p><p>1.<strong>Create new file named .gitignore</strong> with the steps according to the following image:</p><figure><img alt="Create New File" src="https://cdn-images-1.medium.com/max/633/1*rXK_VtzZzIEZ1qcY717wBQ.png" /><figcaption>Create New File</figcaption></figure><figure><img alt="Name the file with .gitignore" src="https://cdn-images-1.medium.com/max/533/1*hdFZdtZB4l-d6Z0hBYYcFA.png" /><figcaption>Name the file with .gitignore</figcaption></figure><p>2. There have been many people who have created the .gitignore file, you can search on Google with the keyword “<strong>gitignore python pycharm”</strong> then there will be many choices similar to the following image:</p><figure><img alt="Python PyCharm .gitignore" src="https://cdn-images-1.medium.com/max/792/1*e-bUIpBIz6_MrOA6i1-EDQ.png" /><figcaption>Python PyCharm .gitignore</figcaption></figure><figure><img alt="MOOWOO/py-gitignore" src="https://cdn-images-1.medium.com/max/1004/1*CsZE0XTAHbvicVTYtLLVoQ.png" /><figcaption><a href="https://gist.github.com/MOOOWOOO/3cf91616c9f3bbc3d1339adfc707b08a">MOOWOO/py-gitignore</a></figcaption></figure><p>3. In this article I use .gitignore from MOOOWOOO. You can immediately see the raw contents through this link <a href="https://gist.github.com/MOOOWOOO/3cf91616c9f3bbc3d1339adfc707b08a"><strong><em>here</em></strong></a><strong><em>.</em></strong></p><p>4. <strong>Copy</strong> all raw contents:</p><figure><img alt="Copy all raw contents" src="https://cdn-images-1.medium.com/max/787/1*G2imhPGz5ILwOyV9OLDxng.png" /><figcaption>Copy all raw contents</figcaption></figure><p>5. <strong>Paste</strong> into the .gitignore file that we made earlier:</p><figure><img alt="Paste into the .gitignore file" src="https://cdn-images-1.medium.com/max/454/1*amlUiLT4ZypHrGmZVmkNUw.png" /><figcaption>Paste into the .gitignore file</figcaption></figure><p>6. Congratulations, the .gitignore file creation is complete.</p><p><strong>SECOND STAGE — CREATE requirements.txt FILE</strong><br>Because we use .gitignore to ignore some things, when someone downloads the project to our GitHub, he has to install the needs related to the library or package that we use on the project. Well, that’s where the function of the requirements.txt file, that we will make at this stage. Here are the steps:</p><p>1.Press <strong>Terminal</strong> in the lower left corner of the PyCharm toolbar as shown below:</p><figure><img alt="Pycharm Terminal" src="https://cdn-images-1.medium.com/max/865/1*7H71SilMcmuVG4vmeucgcQ.png" /><figcaption>Pycharm Terminal</figcaption></figure><p>2. Still referring to the picture above, type the <strong>pip code freeze &gt; requirements.txt</strong>, then <strong>press Enter</strong>.</p><p>3. Wait until a blank line appears as shown in number 1.</p><p>4. Check on the project whether the <strong>requirements.txt</strong> file already exists:</p><figure><img alt="Content in requirement.txt file." src="https://cdn-images-1.medium.com/max/543/1*Y52tuu8PoaMI1BgbtFmjyg.png" /><figcaption>Content in requirement.txt file.</figcaption></figure><p>5. If it already exists, when you open the file it will contain the packages or libraries needed to make the application run correctly.</p><p>6. If you don’t have it please press the down arrow in the project folder twice to refresh the contents of that folder.</p><p>7. If it still doesn’t appear, you can do the <strong>Invalidate caches / restart</strong> PyCharm via the File menu as follows:</p><figure><img alt="File &gt; Invalidate caches / restart" src="https://cdn-images-1.medium.com/max/311/1*yXWZY7VwBxkA5y4tN20qgA.png" /><figcaption>File &gt; Invalidate caches / restart</figcaption></figure><figure><img alt="Choose Invalidate caches and Restart" src="https://cdn-images-1.medium.com/max/432/1*B9Kq2H1drY-wGT-YpYnCCA.png" /><figcaption>Choose Invalidate caches and Restart</figcaption></figure><p>8. PyCharm will restart your project.</p><p>9. If it still doesn’t appear again, <em>maybe you’re not in luck, lol</em>. Please repeat again from step number 1.</p><p>10. Okay, making requirements.txt complete!</p><p><strong>THIRD STAGE — SHARE PROJECT ON GITHUB</strong><br>Okay, here’s what you’ve been waiting for. After successfully passing the above stages, the next is how to share the PyCharm project on GitHub. Check this out!</p><p>1.Make sure you have logged into your GitHub account through a browser (I use Google chrome). This will serve to ensure the success of this stage.</p><p>2. <strong>Click VCS </strong>&gt; <strong>Import into Version Control </strong>&gt; <strong>Share Project on GitHub</strong> on the PyCharm menu like this:</p><figure><img alt="Share Project on GitHub" src="https://cdn-images-1.medium.com/max/576/1*AdSkUVZUcUO6Ks-K4CYXuw.png" /><figcaption>Share Project on GitHub</figcaption></figure><p>3. Furthermore, in order for PyCharm to create a repository in your GitHub account, you must <strong>register</strong> it in PyCharm (you are only required to log in with your GitHub account), as follows:</p><figure><img alt="Login to GitHub using PyCharm" src="https://cdn-images-1.medium.com/max/457/1*L4s3O25EnX3lI1Q4A1n_uQ.png" /><figcaption>Login to GitHub using PyCharm</figcaption></figure><p>4. Next you will be asked to <strong>create a Repository name</strong> (this is just another name for the Folder) and Project Description. Usually it will automatically use the name of the PyCharm project name:</p><figure><img alt="Create a Repository (Project Folder)" src="https://cdn-images-1.medium.com/max/463/1*kwUSIiqQhPeSRm2N3R3Y9g.png" /><figcaption>Create a Repository (Project Folder)</figcaption></figure><p>5. After you click Share (see the picture above), you will be asked to <strong>choose</strong> what you want to share to GitHub (just select all). After you have finished choosing, please click Add:</p><figure><img alt="Initial Commit" src="https://cdn-images-1.medium.com/max/501/1*keNj9EB5Zvriumup7A3W2w.png" /><figcaption>Initial Commit</figcaption></figure><p>6. <strong>Wait</strong> for the upload process to finish, marked with a notification in the lower right corner of PyCharm as follows:</p><figure><img alt="Successfully shared project on GitHub" src="https://cdn-images-1.medium.com/max/343/1*uSxvf0jDFVuR2hdXQJeMMA.png" /><figcaption>Successfully shared project on GitHub</figcaption></figure><p>7. After the notification appears like in the picture above, please <strong>check</strong> the list of repositories in your GitHub account through the browser, and yes you get it:</p><figure><img alt="Your project is now on GitHub" src="https://cdn-images-1.medium.com/max/1013/1*MvA1MTCF-7lBFMHXQ-kAlA.png" /><figcaption>Your project is now on GitHub</figcaption></figure><p>8. Okay, done guys! Goodjob!</p><p>How easy, right?</p><p>What, you say hard?<br>Okay, okay, I’m sure you’re just kidding right?<br> <br>It seems that this is all I can give in the article on <strong>How to Share the Pycharm Project on GitHub</strong>.</p><p>Of course there are many other ways to suit different situations and conditions. So that you are more developed, please explore other ways yourself.</p><p>Thank you for reading.<br>See you next time and Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de837063c12" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/how-to-share-the-pycharm-project-on-github-de837063c12">How to Share The PyCharm Project on Github</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Master Web Scraping using Python in less than 30 minutes]]></title>
            <link>https://medium.com/analytics-vidhya/how-to-master-web-scraping-using-python-in-less-than-30-minutes-2bdb0bd1048c?source=rss-ffd20f8a35cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/2bdb0bd1048c</guid>
            <category><![CDATA[beautifulsoup]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[flask]]></category>
            <category><![CDATA[pycharm]]></category>
            <dc:creator><![CDATA[Eko Misprajiko]]></dc:creator>
            <pubDate>Thu, 12 Mar 2020 04:25:24 GMT</pubDate>
            <atom:updated>2020-05-03T21:57:33.654Z</atom:updated>
            <content:encoded><![CDATA[<h4>Some easy steps to master web scraping using Python</h4><figure><img alt="How to Master Web Scraping using Python in less than 30 minutes" src="https://cdn-images-1.medium.com/max/1024/1*IVCJe9HjFy3WIidHv18Ocg.jpeg" /><figcaption>How to Master Web Scraping using Python in less than 30 minutes</figcaption></figure><p>In this article I will share <strong>how to master web scraping using Python in less than 30 minutes</strong>. Isn’t this cool?</p><p>If you get this article through a search on Google, then you should already know what is meant by web scraping.</p><p>But if you still don’t know, then let me explain it.</p><blockquote><strong>“Web scraping</strong> is an activity carried out to extract certain data in a semi-structured manner from a website page. The page is generally built using markup languages ​​like HTML or XML, the process will analyze the document before starting to retrieve data.<strong>”</strong> Source: <a href="https://en.wikipedia.org/wiki/Web_scraping">Wikipedia</a></blockquote><p>Then <strong>why web scraping?</strong><br><strong>The function of web scraping</strong> is to take data from the web that we scrap, and display the data on our website, we can even save the data into a database if we want. An example of using web scraping is to compare the price of a product between online stores. For example you want to compare iPhone prices on ebay.com with iPhone prices on amazon.com, so you can decide where you want to buy, or you have a review website so you can recommend where to buy based on price comparison.</p><p>In this article I will only share <strong>how to master web scraping using Python in less than 30 minutes</strong>, not to do price comparisons.</p><p><strong>Now, it’s time for practice!</strong><br>Oh wait, before stepping into the program code, there are a few things you need to prepare in order to master web scraping using python in 30 minutes:</p><ol><li>You must have a computer with an OS installed on it, be it Windows or Linux or etc. (this is for sure, <em>lol</em>).</li><li>You must have PyCharm installed on your OS (I recommend you use the latest version of PyCharm <a href="https://www.jetbrains.com/pycharm/download/other.html"><em>here</em></a>)</li><li>You must have Python installed on your OS (I also recommend you to use the latest version of Python <a href="https://www.python.org/downloads/"><em>here</em></a>)</li><li>You must have a browser installed on your OS, in this article I use <a href="https://www.google.co.id/chrome/?brand=CHBD&amp;gclid=EAIaIQobChMI1JP-us2M6AIVgzUrCh04TQaXEAAYASAAEgJdB_D_BwE&amp;gclsrc=aw.ds">Google Chrome</a>.</li><li>You must have a target website that you will be scraping, in this article the target is <a href="https://www.ebay.com/">ebay.com</a>. I chose eBay as a target scraping, because eBay is one of the large online markets that can even be said as a gathering place for sellers and buyers around the world.</li></ol><p>Yes, that’s all the preparation. If you already have everything I mentioned above, then you can start to <strong>master web scraping using Python in 30 minutes</strong>.</p><p><em>Okay, let’s code!</em><br><strong>FIRST STAGE — CREATE NEW PROJECT IN PYCHARM</strong><br>At this stage we will create a new project in PyCharm under the name Mastering-Web-Scraping, here are the steps:</p><ol><li>Open PyCharm and click Create New Project.</li></ol><figure><img alt="Create New Project in PyCharm" src="https://cdn-images-1.medium.com/max/780/1*wzLaZ0W_GLENqniibKzZbQ.png" /><figcaption>Create New Project in PyCharm</figcaption></figure><p>2. Create Project and Virtualenv Names.</p><figure><img alt="Create Project and Virtualenv Names" src="https://cdn-images-1.medium.com/max/780/1*OczH_0SSgADz4n0mjUFBnA.png" /><figcaption>Create Project and Virtualenv Names</figcaption></figure><blockquote>Now you have a project in PyCharm with the name <strong>Mastering-Web-Scraping</strong> along with virtualenv with the same name. <strong>Virtualenv</strong> works so that our project is independent of all libraries or packages built in python, so we can add only the libraries that we need, the effect is that the program we make will be faster.</blockquote><p><strong>SECOND STAGE — INSTALLING PACKAGE REQUESTS</strong><br>To make web scraping using python we need at least 3 packages or libraries namely: <strong>requests</strong>, <strong>beautifulsoup</strong>, and <strong>flask</strong>. At this stage, we will install the <strong>requests library</strong> in the <strong>test_scraping_ebay.py</strong> file. Here are the steps:</p><p>1.<strong>Create a new python file</strong> by <em>right clicking on your project folder &gt; click New &gt; Python file &gt; name the python file with test_scraping_ebay &gt; select Python file &gt; press Enter</em>.</p><figure><img alt="Create a new python file" src="https://cdn-images-1.medium.com/max/716/1*xvjAE7LxUG42On5JUtv5mw.png" /><figcaption>Create a new python file in PyCharm</figcaption></figure><figure><img alt="name the python file with test_scraping_ebay" src="https://cdn-images-1.medium.com/max/510/1*23FCnXcBOw4ruJ86NaMQzw.png" /><figcaption>Name the python file with test_scraping_ebay</figcaption></figure><p>2. In <strong>test_scraping_ebay.py</strong> write the following code:</p><pre>import requests</pre><p>3. Then you will see a <strong>red mark on the word requests</strong> like in this picture:</p><figure><img alt="red mark on the word requests" src="https://cdn-images-1.medium.com/max/390/1*AG1heaRlbpyJxL6r4Hj-dA.png" /><figcaption>Red mark on the word requests</figcaption></figure><p>4. <strong>Make sure the cursor position is like in the picture above</strong> then press <strong>Alt+Enter</strong> then the following options will appear:</p><figure><img alt="Alt+Enter in requests" src="https://cdn-images-1.medium.com/max/427/1*LfCaTZBAkIyaZfZkS2RElA.png" /><figcaption>Alt+Enter in requests</figcaption></figure><p>5. Select <strong>Install package requests</strong> and <strong>press Enter</strong>, look at the bottom center of PyCharm and you will see the following loading:</p><figure><img alt="Installing package requests" src="https://cdn-images-1.medium.com/max/582/1*UpiUKFPLDzdBsobe6nP0_Q.png" /><figcaption>Installing package requests</figcaption></figure><p>6. Wait until loading is complete, then the library installation process or package requests have been completed. Usually marked notifications appear in the lower right corner of PyCharm as follows:</p><figure><img alt="Successfully installed package requests" src="https://cdn-images-1.medium.com/max/321/1*5GFj_tA1mDPJD6D_4Qg3mw.png" /><figcaption>Successfully installed package requests</figcaption></figure><p>7. The library requests installation process is complete.</p><blockquote>Then, what is the function of the library or package requests? Why do we need to install it?<br><strong>The function of the requests</strong> <strong>library</strong> is the same as its name, which is to search for and display the results of the request url (http or https) address of a website similar to a website search in a browser. The return results can be in the form of html, xml, or json. If you want to learn more about library requests, you can read the documentation <a href="https://requests.readthedocs.io/en/master/">here</a>.</blockquote><p><strong>THIRD STAGE — LOOKING FOR REQUEST METHOD</strong><br>To use library requests we need to know several things including request url, request method, parameters, data and json. Here are the steps to find out:</p><p>1.Go to the <a href="https://www.ebay.com/"><strong>ebay.com</strong></a> site through a browser then look for “<strong>iphone</strong>” in the search field, so the following page appears:</p><figure><img alt="iPhone search on ebay.com" src="https://cdn-images-1.medium.com/max/1024/1*oRu6JhcL2bk4W3Fw8Q8MZA.png" /><figcaption>iPhone search on ebay.com</figcaption></figure><p>2. Now you have got the <strong>url</strong>:</p><pre><a href="https://www.ebay.com/sch/i.html?_from=R40&amp;_trksid=m570.l1313&amp;_nkw=iphone&amp;_sacat=0"><strong>https://www.ebay.com/sch/i.html?_from=R40&amp;_trksid=m570.l1313&amp;_nkw=iphone&amp;_sacat=0</strong></a></pre><p>3. Press <strong>Ctrl+Shift+I</strong> so that the inspect elements window will appear on the side or bottom of the browser:</p><figure><img alt="Inspect elements of google dev tools" src="https://cdn-images-1.medium.com/max/1024/1*iZjAmpQzLwEwQlK7BT5PrQ.png" /><figcaption>Inspect elements of google dev tools</figcaption></figure><p>4. If you get the inspect elements display on the side and want to change it to the bottom please read the documentation <a href="https://developers.google.com/web/tools/chrome-devtools/customize/placement"><strong><em>here</em></strong></a>.</p><p>5. Next in the Name column look for <strong>i.html_From=R40&amp;_trksid=m570.l1313&amp;_nkw=iphone&amp;_disabled=0</strong> by: <strong>Click the Network Tab</strong> (1) -&gt; press <strong>Ctrl+R</strong> -&gt; <strong>Select All</strong> (2) -&gt; <strong>Scroll to Top</strong> (3), like this:</p><figure><img alt="Go to the network tab" src="https://cdn-images-1.medium.com/max/1024/1*8OjCZqCC-BkfeMI0fn550A.png" /><figcaption>Go to the network tab</figcaption></figure><p>6. After <strong>clicking number 4</strong> in the image above you will get the following <strong>headers column</strong>:</p><figure><img alt="Headers column" src="https://cdn-images-1.medium.com/max/665/1*5k6LkA1UcZv7lhOyHM7YSQ.png" /><figcaption>Headers column</figcaption></figure><p>7. Now we have the <strong>Request Url</strong> and <strong>Request Method</strong>.</p><p>8. Furthermore, still in the same column as in step no 6, scroll down the tab then you will find the following <strong>parameters</strong>:</p><figure><img alt="Parameters" src="https://cdn-images-1.medium.com/max/624/1*Cdcbkwk0yPGVsQ2WNubOtw.png" /><figcaption>Parameters</figcaption></figure><blockquote>From this stage we have:<br>request method: <strong>GET</strong><br>request url: <a href="https://www.ebay.com/sch/i.html"><strong>https://www.ebay.com/sch/i.html</strong></a><br>parameters: <strong>_from=R40&amp;_trksid=m570.l1313&amp;_nkw=iphone&amp;_disabled=0</strong></blockquote><p><strong>FOURTH STAGE — TRIALING THE REQUESTS LIBRARY</strong><br>After getting the things needed to use requests library, at this stage I will show how to use it:</p><p>1.Open the <strong>test_scraping_ebay.py</strong> file.</p><p>2. The formula of the GET method in requests library are: <strong>requests.get(‘url’, params = {‘par1’: ‘par1 value’, ‘par2’: ‘par2 value’, … … etc})</strong>.</p><p>3. Write the following code according to the formula above but the results are entered into the variable:</p><pre>html_requests = requests.get(<strong>‘https://www.ebay.com/sch/i.html&#39;</strong>,<br>params={<strong>‘_from’</strong>:<strong>’R40&#39;</strong>, <strong>’_trksid’</strong>:<strong>’m570.l1313&#39;</strong>, <strong>’_nkw’</strong>:<strong>’iphone’</strong>, <strong>’_sacat’</strong>:<strong>’0&#39;</strong>})</pre><pre>print(html_requests.text)</pre><p>4. Since we are going to use beautifulsoup as a scraping library, we need html or xml request results, so we need <strong>.text</strong> on the back of the <strong>html_requests</strong> variable, which serves to ensure the results of request are html or xml.</p><p>5. Run the program by pressing <strong>Ctrl+Shift+F10</strong>, then you will see the following results:</p><figure><img alt="Trialing requests library" src="https://cdn-images-1.medium.com/max/595/1*_HJmGIQU-rThQOb3ke06rw.png" /><figcaption>Trialing requests library</figcaption></figure><p>6. The results above will be the same as when you press <strong>Ctrl+U</strong> on the Google Chrome browser with this url:</p><pre><a href="https://www.ebay.com/sch/i.html?_from=R40&amp;_trksid=m570.l1313&amp;_nkw=iphone&amp;_sacat=0">https://www.ebay.com/sch/i.html?_from=R40&amp;_trksid=m570.l1313&amp;_nkw=iphone&amp;_sacat=0</a></pre><p>7. Okay, the trial of library requests has been completed.</p><p><strong>FIVE STAGE — INSTALLING BEAUTIFULSOUP LIBRARY</strong><br>How to install beautifulsoup library in PyCharm is more or less the same as how to install library requests that we have done before. Here is how:</p><p>1.Still in the <strong>test_scraping_ebay.py</strong> file, add the following code immediately below the import requests:</p><pre>from bs4</pre><p>2. Now you will definitely get a <strong>red mark on the bs4</strong> code as follows:</p><figure><img alt="red mark on the bs4" src="https://cdn-images-1.medium.com/max/262/1*ciW7N6So2qgftjbfdkKaiQ.png" /><figcaption>Red mark on the bs4</figcaption></figure><p>3. When the cursor is attached to the bs4 code, press <strong>Alt+Enter</strong>, and the following options will appear:</p><figure><img alt="Alt+Enter bs4 options" src="https://cdn-images-1.medium.com/max/517/1*bybgNDt69zLvQ689LKo0zQ.png" /><figcaption>Alt+Enter bs4 options</figcaption></figure><p>4. Select <strong>install package beautifulsoup4</strong> and <strong>press Enter</strong>, the following loading will appear:</p><figure><img alt="Loading process in installing package beautifulsoup4" src="https://cdn-images-1.medium.com/max/488/1*EB3wzhNISm24eB9kkPyEgA.png" /><figcaption>Loading process in installing package beautifulsoup4</figcaption></figure><p>5. Wait for the process to finish marked with the following notification:</p><figure><img alt="Successfully installing package beautifulsoup4" src="https://cdn-images-1.medium.com/max/341/1*ZyUoKorsM7hRPWHcOHCCTQ.png" /><figcaption>Successfully installing package beautifulsoup4</figcaption></figure><p>6. The installation process is complete but there is still a red mark, complete the previous code to:</p><pre><strong>from </strong>bs4 <strong>import </strong>BeautifulSoup</pre><p>7. Okay this stage is complete.</p><p><strong>SIXTH STAGE — TRIALING BEAUTIFULLSOUP LIBRARY</strong><br>Next, let’s test the beautifulsoup library, but beforehand I will explain that the data we will extract or scrap from this link:<br><a href="https://www.ebay.com/sch/i.html?_from=R40&amp;_trksid=m570.l1313&amp;_nkw=iphone&amp;_sacat=0">https://www.ebay.com/sch/i.html?_from=R40&amp;_trksid=m570.l1313&amp;_nkw=iphone&amp;_sacat=0</a><br>only 3 data are: <strong>Product photos</strong>, <strong>Product names</strong>, and <strong>Link to product details</strong>.<br>Well, here is how:</p><p>1.Open the <strong>test_scraping_ebay.py</strong> file.</p><p>2. Add the following code <strong>after the html_requests variable:</strong></p><pre><em>#declaration BeautifulSoup<br></em>soup = BeautifulSoup(html_requests.text, <strong>‘html.parser’</strong>)</pre><p>3. Then change code <strong><em>print(html_requests.text)</em></strong> to:</p><pre>print(soup)</pre><p>4. In the code I use <strong>html.parser</strong> to make sure the result is html code.</p><p>5. If you run the code above, the results will be the same as the trialing requests library.</p><p>6. Now it’s time to look for photos, open the ebay link that we will scrap then use inspect on one of the product photos on Google Chrome like this:</p><figure><img alt="Right klick on one of the product photos" src="https://cdn-images-1.medium.com/max/624/1*yeOLk9Q4eezPTWb3B399-A.png" /><figcaption>Right klick on one of the product photos</figcaption></figure><p>7. On the inspect tab you will see something similar like this:</p><figure><img alt="Google chrome inspect elements" src="https://cdn-images-1.medium.com/max/722/1*l3rjtpdpnywOLmunwKZ35A.png" /><figcaption>Google chrome inspect elements</figcaption></figure><p>8. First, you will be directed to the “<strong>a</strong>” section in the picture above, in that part we have got 2 of our targets: <strong>Product photo</strong> <strong>and Product name</strong>, but we have not found a url or link to product details. So we have to <strong>scroll a little</strong> over the “<strong>b</strong>” section and you will find the url to the <strong>product details</strong> “<strong>d</strong>”. To do scraping using the beautifulsoup library <strong>we need html tags and attributes</strong>. Then, now we have found the attribute that we will use in the “<strong>c</strong>” section, namely <strong>class = “s-item__image”</strong>.</p><p>9. Return to <strong>test_scraping_ebay.py</strong> and add the following code after the soup variable:</p><pre><em>#Scrapper<br></em>product_image = soup.find_all(attrs={<strong>‘class’</strong>: <strong>‘s-item__image’</strong>})</pre><p>10. Remove the <strong>print(soup)</strong> code because we will use looping with “<strong>for</strong>” to display the results of the scrap, along with the code:</p><pre><em>#Looping product_image with for<br></em><strong>for </strong>img <strong>in </strong>product_image:<br>    print(img)</pre><p>11. Run <strong>test_scraping_ebay.py</strong> with <strong>Ctrl+Shift+F10</strong>, then you will get a collection of “<strong>divs</strong>” from <strong>class=“s-item__image”</strong> as follows:</p><figure><img alt="Div collections from class=”s-item__image”" src="https://cdn-images-1.medium.com/max/674/1*tiugZyzsOh4q1sxVgoFNAw.png" /><figcaption>Div collections from class=“s-item__image”</figcaption></figure><p>12. Then, what if we want to display only the <strong>Product name</strong> from the data above?</p><p>13. Okay, you have to change the code in step number 10 to:</p><pre><em>#Looping product_image with for<br></em><strong>for </strong>img <strong>in </strong>product_image:<br>    print(<strong>img.find(&#39;img&#39;)[&#39;alt&#39;]</strong>)</pre><p>14. Then you will get a list of product names as follows:</p><figure><img alt="A list of product names" src="https://cdn-images-1.medium.com/max/676/1*N5hDkBXLQV-66R_tqQvKUA.png" /><figcaption>A list of product names</figcaption></figure><p>15. Okay, scraping is complete, <strong>here is the full source code from test_scraping_ebay.py</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba532100eb2ba8372f76166b4c48b677/href">https://medium.com/media/ba532100eb2ba8372f76166b4c48b677/href</a></iframe><blockquote><strong>find_all (attrs = {‘html_attributes’: ‘html_attributes_value’})</strong> functions to display all the tags and attributes that are contained in html_attributes_value in the html_atrributes declared.<br><strong>find (‘tag’) [‘attributes’]</strong> functions to retrieve the value of one of the specific tags contained in find_all (attrs = {‘html_attributes’: ‘html_attributes_value’}).</blockquote><p><strong>STAGE SEVEN — SHOWING THE RESULTS OF SCRAPING WITH FLASK</strong><br>In the previous stage we have successfully scraped into the following url: <a href="https://www.ebay.com/sch/i.html?_from=R40&amp;_trksid=m570.l1313&amp;_nkw=iphone&amp;_sacat=0">https://www.ebay.com/sch/i.html?_from=R40&amp;_trksid=m570.l1313&amp;_nkw=iphone&amp;_sacat=0</a><br>At this stage I will explain how to display the scraping obtained from the previous stage to a simple website that I will make using flask. <em>I will not use images for parts that I have explained in previous stages, such as: creating a new python file, installation process, and notifications when the install process is successful, because it makes no difference</em>.<em> lol</em></p><p>1.<strong>Create a new python file</strong> with the name <strong>run</strong>, then you will have a <strong>run.py</strong> file.</p><p>2. <strong>Import</strong> <strong>requests</strong> and <strong>beautifulsoup</strong>:</p><pre><strong>import </strong>requests<br><strong>from </strong>bs4 <strong>import </strong>BeautifulSoup</pre><p>3. <strong>Install the package flask</strong>, the same way that you installed the beautifulsoup package, just write:</p><pre><strong>from </strong>flask</pre><p>4. When the cursor is on the word flask press <strong>Alt+Enter</strong> then select <strong>install package flask</strong>.</p><p>5. Wait until the installation process is complete.</p><p>6. After the installation process is complete, continue the code in step no. 3:</p><pre><strong>from </strong>flask <strong>import </strong>Flask, render_template</pre><p>7. To <strong>start Flask</strong>, make it a habit to make the opening and closing lines of flask code as follows:</p><pre><em>#start flask code<br></em>app = Flask(__name__)</pre><pre><em>#scraping code will start here</em></pre><pre><em>#end flask code<br></em><strong>if </strong>__name__ == <strong>&#39;__main__&#39;</strong>:<br>app.run(debug=<strong>True</strong>)</pre><p>8. <strong>Add the following code</strong> immediately below <em>#scraping code will start here</em>:</p><pre><em>#scraping code will start here<br></em>@app.route(‘/’)<br><strong>def </strong>home():<br>    <strong>return </strong>render_template(<strong>&#39;index.html&#39;</strong>)</pre><p>9. Because we use <strong>render_template</strong>, we need to <strong>create a folder</strong> with the name <strong>templates</strong> in our project, like this:</p><figure><img alt="Right Klick — New — Directory" src="https://cdn-images-1.medium.com/max/661/1*1ANfrPcdqW6j0cAYGnEkuw.png" /><figcaption>Right Klick — New — Directory</figcaption></figure><figure><img alt="Make directory name" src="https://cdn-images-1.medium.com/max/558/1*JiWTuIPXDK28f9xZ3Rejxw.png" /><figcaption>Make directory name</figcaption></figure><p>10. <strong>Create an html file</strong> with the name <strong>index</strong> in the templates folder that we created earlier:</p><figure><img alt="Create a new html file" src="https://cdn-images-1.medium.com/max/583/1*GIICih5L0ASzUCAwM5YmWg.png" /><figcaption>Create a new html file</figcaption></figure><figure><img alt="Make the index html name" src="https://cdn-images-1.medium.com/max/334/1*y9Jg8IvscjDOy3b5y0cbTQ.png" /><figcaption>Make the index html name</figcaption></figure><p>11. A slight modification to the html code becomes:</p><pre>&lt;!DOCTYPE <strong>html</strong>&gt;<br>&lt;<strong>html lang=”en”</strong>&gt;<br>&lt;<strong>head</strong>&gt;<br>   &lt;<strong>meta charset=”UTF-8&quot;</strong>&gt;<br>   &lt;<strong>title</strong>&gt;Scraping Ebay&lt;/<strong>title</strong>&gt;<br>&lt;/<strong>head</strong>&gt;<br>&lt;<strong>body</strong>&gt;<br>    &lt;<strong>h1</strong>&gt;This is the index.html page&lt;/<strong>h1</strong>&gt;<br>&lt;/<strong>body</strong>&gt;<br>&lt;/<strong>html</strong>&gt;</pre><p>12. Go back to the <strong>run.py</strong> file then press <strong>Ctrl+Shift+F10</strong> then you will get something like this on the run tab:</p><figure><img alt="Running the run.py file" src="https://cdn-images-1.medium.com/max/545/1*PEOGhuZCZyBg-IAgH2KWLg.png" /><figcaption>Running the run.py file</figcaption></figure><p>13. Press <a href="http://127.0.0.1:5000/"><strong>http://127.0.0.1:5000/</strong></a> then you will get the following page:</p><figure><img alt="index.html page" src="https://cdn-images-1.medium.com/max/443/1*oBEUsgdSCMTE35L9xkPo5A.png" /><figcaption>index.html page</figcaption></figure><p>14. Okay we have successfully used flask.</p><p>15. Next, in this article I will use the <strong>bootstrap4</strong> template to display scraping results. You can see the html code <a href="https://www.w3schools.com/bootstrap4/tryit.asp?filename=trybs_navbar_fixed&amp;stacked=h"><strong><em>here</em></strong></a>.</p><figure><img alt="Bootstrap4 w3schools.com" src="https://cdn-images-1.medium.com/max/898/1*ewK4sDgcDjqatrTsv0wiIA.png" /><figcaption>Bootstrap4<a href="https://www.w3schools.com/bootstrap4/tryit.asp?filename=trybs_navbar_fixed&amp;stacked=h"> w3schools.com</a></figcaption></figure><p>16. Copy and paste all the bootstrap4 html code to <strong>index.html</strong>.</p><p>17. <strong>Refresh</strong> the page <a href="http://127.0.0.1:5000/">http://127.0.0.1:5000/</a> then you will see the following display:</p><figure><img alt="index.html with bootstrap4" src="https://cdn-images-1.medium.com/max/728/1*3PA7JTPOyoXXQuexJHqH5w.png" /><figcaption>index.html with bootstrap4</figcaption></figure><p>18. <strong>Modify</strong> the bootstrap4 html code to:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/342963837ae7cd9c261b6d5108ec7e72/href">https://medium.com/media/342963837ae7cd9c261b6d5108ec7e72/href</a></iframe><p>19. This is the appearance after the code has been modified:</p><figure><img alt="index.html with bootstrap4 after modified" src="https://cdn-images-1.medium.com/max/431/1*HsxZ03dLcdZbj2HXvceYYA.png" /><figcaption>index.html with bootstrap4 after modified</figcaption></figure><p>20. Okay bootstrap4 is ready.</p><p>21. Returning to the <strong>run.py</strong> file, modify “<strong>def home()</strong>” by adding some code that we made earlier in <strong>test_scraping_ebay.py</strong> to be as follows:</p><pre><strong>def </strong>home():<br>   <em>#declaration requests<br>   </em>html_requests = requests.get(<strong>&#39;https://www.ebay.com/sch/i.html&#39;</strong>, params={<strong>&#39;_from&#39;</strong>:<strong>&#39;R40&#39;</strong>, <strong>&#39;_trksid&#39;</strong>:<strong>&#39;m570.l1313&#39;</strong>, <strong>&#39;_nkw&#39;</strong>:<strong>&#39;iphone&#39;</strong>, <strong>&#39;_sacat&#39;</strong>:<strong>&#39;0&#39;</strong>})</pre><pre><em>   #declaration BeautifulSoup<br>   </em>soup = BeautifulSoup(html_requests.text, <strong>&#39;html.parser&#39;</strong>)<br>   <br>   <em>#Scrapper<br>   </em>product_image = soup.find_all(attrs={<strong>&#39;class&#39;</strong>: <strong>&#39;s-item__image&#39;</strong>})<br>   <br>   <strong>return </strong>render_template(<strong>&#39;index.html&#39;</strong>)</pre><p>22. Modify the <strong>return render_template (‘index.html’)</strong> to:</p><pre><strong>return </strong>render_template(<strong>&#39;index.html&#39;</strong>, <strong>images=product_image</strong>)</pre><p>23. Open the <strong>index.html</strong> file and look for the following code:</p><pre>&lt;<strong>div class=&quot;container-fluid&quot; style=&quot;</strong>margin-top:80px<strong>&quot;</strong>&gt;</pre><pre>&lt;/<strong>div</strong>&gt;</pre><p>24. Add the following code between the html code in step no 23, as follows:</p><pre>&lt;<strong>div</strong> class=&quot;container-fluid&quot; style<strong>=&quot;</strong>margin-top:80px<strong>&quot;</strong>&gt;<br>     {% <strong>for image in images: </strong>%}<br>        {{<strong>image</strong>|safe}}<br>        &lt;<strong>a</strong> href=<strong>&quot;{{image.find(&#39;a&#39;)[&#39;href&#39;]|safe}}&quot;&gt;<br>        </strong>{{<strong>image.find(&#39;a&#39;).find(&#39;img&#39;)[&#39;alt&#39;]</strong>|safe}}&lt;/<strong>a</strong>&gt;<br>     {% endfor %}<br>&lt;/<strong>div</strong>&gt;</pre><blockquote><strong>images</strong> are variables that we have created in the <strong>run.py</strong> file, which is in the section: return render_template <strong>(</strong>‘index.html’,<strong> images = product_image)</strong></blockquote><p>25. Refresh the page <a href="http://127.0.0.1:5000/"><strong>http://127.0.0.1:5000/</strong></a>, and yeah you got it:</p><figure><img alt="index.html with scraper" src="https://cdn-images-1.medium.com/max/415/1*oYJy2UDU29GUO-UE0n8F8w.png" /><figcaption>index.html with scraper</figcaption></figure><p>26. Okay, done guys! Goodjob!</p><p>Here is the <strong>full source code for run.py</strong> file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/25111702fa1af379512b3944d808f1d1/href">https://medium.com/media/25111702fa1af379512b3944d808f1d1/href</a></iframe><p>Then, this is <strong>the full source code for index.html</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/087ad6c2dcb0b0958e7154ebb4512e63/href">https://medium.com/media/087ad6c2dcb0b0958e7154ebb4512e63/href</a></iframe><p>What? You only need 10 minutes to complete it?<br><em>Okay, I know, I know, you just copy paste it, right? lol</em></p><p>Oh, if after you read this article and you still haven’t mastered web scraping, that means you still have to upgrade your skills boy!<br><em>Haha, cheer up!</em></p><p>In closing, you can check the code below in my github, feel free to clone and use it at your own.</p><p><a href="https://github.com/EkoMisprajiko/Mastering-Web-Scraping">EkoMisprajiko/Mastering-Web-Scraping</a></p><p>If you don’t know how to share your PyCharm project to github, you can read my article <a href="https://medium.com/@ekomisprajiko/how-to-share-pycharms-project-on-github-de837063c12"><strong>How to share the PyCharm project on Github</strong></a>.</p><p>It seems like this is all I can give in the article: <strong>how to master web scraping using Python in less than 30 minutes</strong>.<br>Thank you for reading.<br>See you next time and Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2bdb0bd1048c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/how-to-master-web-scraping-using-python-in-less-than-30-minutes-2bdb0bd1048c">How to Master Web Scraping using Python in less than 30 minutes</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>