<?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 Swarnabha Das on Medium]]></title>
        <description><![CDATA[Stories by Swarnabha Das on Medium]]></description>
        <link>https://medium.com/@im.swarnabha2001?source=rss-d16dd05baf18------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HwgC3gesavMf3jRN5ravNg.jpeg</url>
            <title>Stories by Swarnabha Das on Medium</title>
            <link>https://medium.com/@im.swarnabha2001?source=rss-d16dd05baf18------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 13:29:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@im.swarnabha2001/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[Making a Fun Weather Web app and Deploying it on Heroku]]></title>
            <link>https://medium.com/@im.swarnabha2001/making-a-fun-weather-web-app-and-deploying-it-on-heroku-3119cd80171c?source=rss-d16dd05baf18------2</link>
            <guid isPermaLink="false">https://medium.com/p/3119cd80171c</guid>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[heroku]]></category>
            <dc:creator><![CDATA[Swarnabha Das]]></dc:creator>
            <pubDate>Wed, 29 Jul 2020 20:34:32 GMT</pubDate>
            <atom:updated>2020-07-30T16:30:38.075Z</atom:updated>
            <content:encoded><![CDATA[<h3>🌧️Making a Fun Weather Web app and Deploying it on Heroku💻</h3><p><strong>It’s Live </strong>🥳<strong>: </strong><a href="https://streamlit-sd-forecast-app.herokuapp.com/">https://streamlit-sd-forecast-app.herokuapp.com/</a></p><p>Monsoons have arrived in India. Like every other year, after a scorching summer spell, its time for the rains to set in. With the arrival of the South-West trade winds in Kerala by the beginning of June, it prepares to cover the entire country by mid-July. Unlike the other years, we are forced to sit back at our homes, with the Corporations and authorities around the world having no other option than providing flexible working conditions including work from home.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yjTOfOeMx570TFLWuHPMbA.jpeg" /></figure><p>The novel Coronavirus changed everything overnight, the lockdown was enforced, and social distancing became the new norm. Till now, there hasn’t been much success in preparing the cure for this virus. All that we can do is keeping our immune system strong and following all the social distancing and the prevention norms.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FS6CCUz7PfIQen90pQI%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fmolangofficialpage-hello-hi-hey-S6CCUz7PfIQen90pQI&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2FS6CCUz7PfIQen90pQI%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/ecac0ecc7f0ca9f1fadb252d5e39c66e/href">https://medium.com/media/ecac0ecc7f0ca9f1fadb252d5e39c66e/href</a></iframe><p>Barring this year, every time we plan for something new like travelling, having fun, etc, several thoughts pop up in our mind. Pending work, prior commitments, weather, etc, always tried to cancel our plans. Especially during monsoons, a rainy day often seems to drive us so dull and drowsy. No one loves getting drenched in the rains on his/her way to the office. It’s quite tiresome and exhausting for people who avail public transport during the heavy showers. So before preparing to leave, often do we check the Google Weather and decide on taking an umbrella or not.</p><p>But ever wondered, how the weather results are displayed? Anywhere, at any corner in the world, with the help of Google, we can figure out the weather of the place we are currently in.</p><p>The simplest answer to this question is using the several different <strong>weather APIs.</strong> There are a bunch of different APIs available for use that can be called from our scripts. One such API is the <strong>OpenWeatherMap(OWM) API</strong>. Calling this Weather API we can access the weather data of over 200,000 cities all over the world. The data is returned to us in J<strong>SON, XML and HTML</strong> format.</p><h3>So without any further due let’s get started🎬!</h3><h4>First things first!!</h4><p>First step: We have to register an account on <a href="https://openweathermap.org/">https://openweathermap.org/</a> and generate an <strong>API Key</strong>. There are several keys available with different subscriptions available but it would always be wise to select the free one for study/practice purposes. Once it gets activated it can be used as a parameter to request data from the <strong>REST API</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/1*driNhJ6f8cHDtyjcXAeHMA.png" /><figcaption>PyOWM</figcaption></figure><p>I’ll be using Python for this project. <strong>PyOWM</strong> is a client Python wrapper library for <strong>OpenWeatherMap web APIs</strong>. It allows quick and easy consumption of OWM data from Python applications via a simple object model and in a human-friendly fashion. It can display a large variety of information ranging from temperature, humidity, wind-speed to sunset, sunrise time and even the rain/storm predictions. Awesome, isn’t it?</p><h3><strong>What kind of data do I get with PyOWM ?</strong></h3><p>With <strong>PyOWM</strong> you can integrate into your code any of the following OpenWeatherMap web APIs:</p><blockquote><strong>Weather API v2.5</strong> + <strong>OneCall API</strong>, providing current weather data, weather forecasts, weather history</blockquote><blockquote><strong>Agro API v1.0</strong>, providing soil data and satellite imagery search and download</blockquote><blockquote><strong>Air Pollution API v3.0</strong>, providing data about CO, O3, NO2 and SO2</blockquote><blockquote><strong>UV Index API v3.0</strong>, providing data about Ultraviolet exposition</blockquote><blockquote><strong>Stations API v3.0</strong>, allowing to create and manage meteo-station and publish local weather measurements</blockquote><blockquote><strong>Weather Alerts API v3.0</strong>, allowing to set triggers on weather conditions and areas and poll for spawned alerts</blockquote><blockquote><strong>Image tiles</strong> for several map layers provided by OWM</blockquote><p>To install this module type this in your terminal.</p><pre>pip install pyowm</pre><h3>Let’s get the Basics covered before we dive into making the Python🐍Web App.</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a45ab1587b108ea5ed84cd6c0e352ad0/href">https://medium.com/media/a45ab1587b108ea5ed84cd6c0e352ad0/href</a></iframe><blockquote>Here we initialize Pyowm with an API key.</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1bcb407b905dc2ada41a0adb47dc424b/href">https://medium.com/media/1bcb407b905dc2ada41a0adb47dc424b/href</a></iframe><blockquote>We take the city ID/city Name/ Latitude-Longitude /Zip-code as input and call the weather_manager() instance to fetch the weather data for that place.</blockquote><p>We feed in the inputs to the different functions of this instance. Here ‘obs’ pertains to an object returned by <strong>pyowm.weatherapi25</strong>.We call for the temperature values which returns us a dictionary, from which we select the <strong>‘temp’</strong> key.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a7ac13a3782198e8eb1de7882b6cd7b/href">https://medium.com/media/2a7ac13a3782198e8eb1de7882b6cd7b/href</a></iframe><blockquote>Unlike the previous step where we called the temperature values, now we call the clouds and the wind functions.</blockquote><p>Having requested the dictionary we display the required values using the key.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a229b71f5a5a6f6c76cfbbfc82f95b8/href">https://medium.com/media/5a229b71f5a5a6f6c76cfbbfc82f95b8/href</a></iframe><blockquote>Similarly, like the previous ones, to get the sunset and sunrise time, we call the sunset_time(‘iso’) and sunrise_time(‘iso’) functions of the weather object.</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e23ef64a29a0bc7dadd772ca7e2a0cfb/href">https://medium.com/media/e23ef64a29a0bc7dadd772ca7e2a0cfb/href</a></iframe><blockquote>Forecaster is a class encapsulating weather forecast data for a certain location and relative to a specific time interval (forecast for every three hours or every day). It provides abstractions on the top of it to let programmers exploit weather forecast data in a human-friendly fashion.</blockquote><p>Here, we get the weather details at a specific time for the next day.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c70a1c5ff491d80b492b065780f654d/href">https://medium.com/media/9c70a1c5ff491d80b492b065780f654d/href</a></iframe><blockquote>The Forecaster class has several unique methods to call for which returns a Boolean value or a tuple or a list of objects.</blockquote><p>In this code snippet, we call the functions which display the Boolean values (<strong>True of False</strong>).</p><h3>Now, let’s start with the FUN Part: Making the Python🐍Web App.</h3><ul><li>Making the Streamlit Web App.</li><li>Feeding in the information, plotting graphs</li><li>Deployment</li></ul><h4>Making the Web App UI :</h4><p>First, lets install Streamlit :</p><pre>pip install streamlit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FmD5XSgBiNnSK8bCcKzh1Q.jpeg" /><figcaption>Code for this ⬇️</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/89be9df0410a34b2705fc607c2b9759c/href">https://medium.com/media/89be9df0410a34b2705fc607c2b9759c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*J74xC7xBvUxh2PDQ0iQLiA.jpeg" /><figcaption>Code for this ⬇️</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/85a879a421dfeb59338dbf507fdafec6/href">https://medium.com/media/85a879a421dfeb59338dbf507fdafec6/href</a></iframe><blockquote><strong><em>Yes!! It’s that Simple😄</em></strong></blockquote><h4>Plotting Graphs and Calculations🖩:</h4><blockquote>We initialize all the API instances at the beginning. Having created the 4 empty lists, we append the dates for the upcoming five days in the ‘days’ list. The ‘dates_2’ list is incorporated just to avoid repetition of dates. Next, we find the minimum and maximum temperature for each day and store in their respective lists.</blockquote><p>As per user input from the web app, we pass the lists for getting the respective line and bar graphs. We keep both the tabular format and the graphical plots just for the sake of visual representation.</p><blockquote>Apart from the minimum and maximum temperature, we display the detailed weather forecast which includes the sunset and sunrise time, sky conditions and wind speed. As an added feature, if there’s any Storm/ Snow/ Tornado/ Hurricane/ Rain prediction for that day, it will be displayed under the Alerts/Temperature Changes section.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*DmwGj-54H6SERWGh96Fchg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*DPnRJcgRSyaMcN0kcwW_kA.jpeg" /><figcaption>Results for the 6-day Forecast</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b452d3006c0dbbc1d0053eae902c25a3/href">https://medium.com/media/b452d3006c0dbbc1d0053eae902c25a3/href</a></iframe><blockquote>The plot_line() and plot_bar() function is called by the find_min_max() function. The ‘days’ list that is passed contains the values in an encoded representation which we won’t understand. Hence to convert it into human- perceivable format, we use the dates.date2num and the set_major_formatter() function.</blockquote><p>To embed the temperature values in the graph we incorporate the two for loops.</p><blockquote>Now as per the user input we get the graphs plotted using the plt.plot(for line graph) and plt.bar(for bar graph). To print the graphs in Streamlit we use the st.pyplot() just like our standard plt.show(). At the end plt.clf() is used to clear the graphs making space for the next graph to be printed.</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c61513a17540636baa1927c89539845/href">https://medium.com/media/8c61513a17540636baa1927c89539845/href</a></iframe><blockquote>We initialize all the API instances at the beginning as usual. Since this block is used to predict the temperature for a particular time the next day, we don’t need to use any empty lists in here.</blockquote><blockquote>We create the forecaster class and get the time stored in an instance of timestamps. Soon we get the temperature in either Celsius/Fahrenheit for the selected time.</blockquote><p>Just like the previous part, we introduce the <strong>temperature changes based alerts</strong> for that time and display if there’s any.</p><h4>Deployment❤️</h4><p>Believe me, deploying Python Web Apps on <strong>Heroku</strong> is quite easy. I’ll guide you through the steps one by one.</p><ol><li>Head over to <a href="https://signup.heroku.com/">https://signup.heroku.com/</a> and register a free account.</li><li>Keep your credentials handy as you will need them in a later stage.</li><li>Download Heroku cli from <a href="https://devcenter.heroku.com/articles/heroku-cli">https://devcenter.heroku.com/articles/heroku-cli</a></li><li>Ensure to add Heroku/bin in your environment variables PATH. Head to <a href="https://devcenter.heroku.com/articles/config-vars">https://devcenter.heroku.com/articles/config-vars</a> if you haven’t done anything like this before.</li><li>Once it’s done you are good to go.</li><li>Go to your original folder(Suppose name is Weather) and create a requirements.txt and runtime.txt(python 3.7 and up)file. Its a must.</li><li>create a setup.sh file and a Procfile in the same folder. Refer to this <a href="https://devcenter.heroku.com/articles/procfile">https://devcenter.heroku.com/articles/procfile</a></li></ol><p>8. Open your terminal and type⌨️:</p><pre>cd Weather</pre><p>9. Initialize a <strong>Heroku</strong> web app :</p><pre>heroku create &lt;Your app name&gt;-app</pre><p>10. Initialize an empty repository in the folder:</p><pre>git init(in that folder)</pre><p>11. Add the files in the Weather folder:</p><pre>git add .</pre><p>12. Commit the staged changes:</p><pre>git commit -m &quot;Your Message&quot;</pre><p>13. This step is done to ensure the app created is linked to the Weather folder</p><pre>git remote -v</pre><p>14. If yes, push the files to Heroku or else do visit this link : <a href="https://devcenter.heroku.com/articles/git">https://devcenter.heroku.com/articles/git</a>:</p><pre>git push heroku master</pre><blockquote>Woo-hooo🎉 you just deployed your Web App. Open the link shown in the terminal in your browser. You will see the magic unfold!!</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FfxsqOYnIMEefC%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fwell-done-fxsqOYnIMEefC&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2FfxsqOYnIMEefC%2Fgiphy.gif%3Fcid%3D790b76113e787b06aef1be7f7b50fc190c941a542069a25f%26rid%3Dgiphy.gif%26ct%3Dg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="196" frameborder="0" scrolling="no"><a href="https://medium.com/media/9bfd5bb651dc8c935e615d8619e6a52e/href">https://medium.com/media/9bfd5bb651dc8c935e615d8619e6a52e/href</a></iframe><p>⚒️This Web App is subjected to further improvements. More features will be added soon.</p><p>🙏Thank You. Hope you enjoyed giving a read😊😉.</p><p><a href="https://github.com/sd2001/Heroku-pyowm">sd2001/Heroku-pyowm</a></p><h3>📚References/Bibliography🕮:</h3><ul><li><a href="https://pyowm.readthedocs.io/en/latest/">https://pyowm.readthedocs.io/en/latest/</a></li><li><a href="https://github.com/csparpa/pyowm">https://github.com/csparpa/pyowm</a></li><li><a href="https://medium.com/nexttech/how-to-use-the-openweathermap-api-with-python-c84cc7075cfc">https://medium.com/nexttech/how-to-use-the-openweathermap-api-with-python-c84cc7075cfc</a></li><li><a href="https://medium.com/nexttech/learning-python-openweathermap-with-andrew-sverdrup-1cc63a51ba82">https://medium.com/nexttech/learning-python-openweathermap-with-andrew-sverdrup-1cc63a51ba82</a></li><li><a href="https://devcenter.heroku.com/categories/reference">https://devcenter.heroku.com/categories/reference</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3119cd80171c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[25 Lesser-known Python Modules that can Improve the Way we Code.]]></title>
            <link>https://medium.com/srm-mic/25-lesser-known-python-modules-that-can-improve-the-way-we-code-28f1af661374?source=rss-d16dd05baf18------2</link>
            <guid isPermaLink="false">https://medium.com/p/28f1af661374</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[modules]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[web]]></category>
            <dc:creator><![CDATA[Swarnabha Das]]></dc:creator>
            <pubDate>Tue, 19 May 2020 16:00:58 GMT</pubDate>
            <atom:updated>2020-05-19T17:06:19.210Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Python</strong> is a beautiful programming language. It has everything you will probably ever need. It has an easy to use package manager that helps us in building web apps, desktop apps to networking apps and data-based applications. It boasts a large developer’s community support.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*uo4DR3RwF5okzfN7ENHvrw.png" /></figure><p>Here I have presented a list of <strong>25 modules</strong> that seemed quite useful and interactive to me. Most of them will probably be completely unknown to you, yet the features and functionalities they offer are quite indispensable for multi-purpose programmers.</p><h4>1. Turtle</h4><p>Turtle graphics is a popular way of introducing programming to kids. It was part of the original Logo programming language developed by Wally Feurzeig, Seymour Papert and Cynthia Solomon in 1967.</p><p>The turtle module is an extended re-implementation of the same-named module from the Python standard distribution up to version Python 2.5.</p><p>It tries to keep the merits of the old turtle module and to be (nearly) 100% compatible with it. This means in the first place to enable the learner to use all the commands, classes and methods interactively while using the module.</p><blockquote>Here we try to implement making a rainbow benzene pattern using our turtle.</blockquote><pre>Command line setup for this module is :</pre><pre>pip install turtle</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99551827670633675e41a6598ff65b6e/href">https://medium.com/media/99551827670633675e41a6598ff65b6e/href</a></iframe><figure><img alt="Output of the Above Python Code snippet." src="https://cdn-images-1.medium.com/max/956/1*DhIMf62cMZYrp-H_o8BepQ.png" /><figcaption>The output of the above Code Snippet.</figcaption></figure><h4>2. PyAutoGUI</h4><p>PyAutoGUI is a cross-platform GUI automation Python module for human beings. It is used to programmatically control the mouse &amp; keyboard.</p><p>PyAutoGUI lets your Python scripts control the mouse and keyboard to automate interactions with other applications. The API is designed to be quite simple. PyAutoGUI works on Windows, macOS, and Linux, and runs on Python 2 and 3.</p><blockquote><strong>PyAutoGUI has several features:</strong></blockquote><blockquote>· Moving the mouse and clicking or typing in the windows of other applications.</blockquote><blockquote>· Sending keystrokes to applications (for example, to fill out forms).</blockquote><blockquote>· Take screenshots, and given an image (for example, of a button or checkbox), find it on the screen.</blockquote><blockquote>· Locate an application’s window, and move, resize, maximize, minimize, or close it (Windows-only, currently)</blockquote><blockquote>· Display message boxes for user interaction while your GUI automation script runs.</blockquote><pre>Command line setup for this module is :</pre><pre>pip install pyautogui</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c4710c1d6ba941a0ec1db525066b9f2/href">https://medium.com/media/5c4710c1d6ba941a0ec1db525066b9f2/href</a></iframe><h4>3. PyQRCode</h4><p>A QR code generator is written purely in Python with SVG, EPS, PNG and terminal output.</p><p>The pyqrcode module is a QR code generator that is simple to use and written in pure python. The module can automate most of the building process for creating QR codes. Most codes can be created using only two lines of code!</p><p>Unlike other generators, all of the helpers can be controlled manually. You are free to set any or all of the properties of your QR code.</p><p>QR codes can be saved as SVG, PNG (by using the pypng module), and plain text. They can also be displayed directly in most Linux terminal emulators. PIL is not used to render the image files.</p><p>The pyqrcode module attempts to follow the QR code standard as closely as possible. The terminology and the encodings used in pyqrcode come directly from the standard. This module also follows the algorithm laid out in the standard.</p><pre>Command line setup for this module is :</pre><pre>pip install pyqrcode</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/38446d27c30a8f8826382be082651fa1/href">https://medium.com/media/38446d27c30a8f8826382be082651fa1/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*6g07VVsR_hYdsRPAfpcJ2Q.png" /><figcaption>Output for the above code snippet. Scan this to visit python.org directly.</figcaption></figure><h4>4. BeautifulSoup</h4><p>Beautiful Soup is a library that makes it easy to scrape information from web pages. It sits atop an HTML or XML parser, providing Pythonic idioms for iterating, searching, and modifying the parse tree.</p><p>Say you’ve found some webpages that display data relevant to your research, such as date or address information, but that does not provide any way of downloading the data directly. Beautiful Soup helps you pull particular content from a webpage, remove the HTML markup, and save the information. It is a tool for web scraping that helps you clean up and parse the documents you have pulled down from the web.</p><p>We import BeautifulSoup from a library called bs4.</p><blockquote>But we should be well aware of the web scraping rules of that particular website. Be sure to read the terms and conditions of the website before using it for any commercial purposes.</blockquote><pre>Command line setup for this module is :<br>pip install bs4</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b9cf4d4229b25a3a40c41fe6c7364f4/href">https://medium.com/media/5b9cf4d4229b25a3a40c41fe6c7364f4/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*KDngFxhe4eko47JgRir-eA.png" /><figcaption>The value returned by the code snippet.</figcaption></figure><h4>5. Emoji</h4><p>The entire set of Emoji codes as defined by the Unicode consortium is supported in addition to a bunch of aliases. By default, only the official list is enabled but doing emoji.emojize(use_aliases=True) enables both the full list and aliases.</p><p>There are multiple ways we can print the Emojis in Python. Let’s see how to print Emojis with Unicodes, CLDR names and emoji module.</p><p>Using Unicodes:<br> Every emoji has a Unicode associated with it. Emojis also have a CLDR short name, which can also be used.</p><pre>Command line setup for this module is :</pre><pre>pip install emoji</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d572f44079f7904abadc62bc92cc2d08/href">https://medium.com/media/d572f44079f7904abadc62bc92cc2d08/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*PgKXWe0eCK8bm309FUjN9Q.png" /></figure><h4>6. PyWhatkit</h4><p>Pywhatkit is an interactive Python library for Sending Whatsapp messages at a certain time. It has several other features too.</p><p>It can also display any information depending on the user input. What this module does is, it performs a Google search on the topic and displays the most relevant details in front of us. The best thing about this is we can easily specify how long or short the displayed info should be. It also prints the details of all the text messages that we have been sending using this module.</p><p>Pywhatkit can also play Youtube videos based on the user-provided input.</p><pre>Command line setup for this module is :</pre><pre>pip install pywhatkit</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/89642ac5ca37dcddec49827d32899de1/href">https://medium.com/media/89642ac5ca37dcddec49827d32899de1/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9dROEQ2l3KCu36Rie6VFTw.png" /><figcaption>The output of the above code Snippet</figcaption></figure><h4>7. String</h4><p>The string module contains several useful constants and classes, as well as some deprecated legacy functions that are also available as methods on strings. Besides, Python’s built-in string classes support the sequence type methods described in the Sequence Types — str, Unicode, list, tuple, bytearray, buffer, xrange section, and also the string-specific methods.</p><p>Here we use this module to generate a random password.</p><blockquote>Ever wondered how Elon Musk named his child?</blockquote><blockquote>Yeah, you guessed it correct!!</blockquote><blockquote>Yes! He used this module to generate his name. :-)</blockquote><pre>Command line setup for this module is :</pre><pre>pip install string (Although its a preinstalled dependency)</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad74b70d92e3a8d43fa7a4dd9f57969b/href">https://medium.com/media/ad74b70d92e3a8d43fa7a4dd9f57969b/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wYLo8KTEev-yfq52ziCYTQ.png" /><figcaption>Output for the above code snippet.</figcaption></figure><h4>8. PyShorteners</h4><p>A simple URL shortening API wrapper Python library.</p><p>Pyshorteners is a Python library to help you shorten and expand URLs using the most famous URL Shorteners available.</p><p>With pyshorteners, we can generate a short URL or expand a shortened link. It can be of several formats like the tinyurl ,bit.ly, adf.ly, tiny.cc, git.io, da.gd,etc formats.</p><blockquote>Here we have the tinyurl API implementation. Now let’s see how this module can be used to shorten a URL using tinyurl Services.</blockquote><pre>Command line setup for this module is :</pre><pre>pip install pyshorteners</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/900339b15f00818c33c3c37dd8deeb2c/href">https://medium.com/media/900339b15f00818c33c3c37dd8deeb2c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*Z7VUwwYPpPiaSaLx_FNU9Q.png" /><figcaption>This is how the links look like</figcaption></figure><h4>9. Win10Toast</h4><p>An easy-to-use Python library for displaying Windows 10 Toast Notifications which is useful for Windows GUI development. The source code is available on GitHub. Under the hood, win10toast uses the pywin32 package.</p><p>We can create a notifier for the events that occurred in Windows using <em>Python</em>. This is very simple with the win10toast module. If you are familiar with the <strong>Toast</strong> in Android then understanding the Toast notifications with Python is a piece of cake.</p><blockquote>Suppose you are training your model which might require hours to finish and you decide to watch a movie in between. So instead of unlimited pauses and resume to check its progress, we can use this notification module to help get us notified as and when the training is done.</blockquote><pre>Command line setup for this module is :</pre><pre>pip install win10toast</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/002f69679b532c1604b2afd038ab387d/href">https://medium.com/media/002f69679b532c1604b2afd038ab387d/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*piMc95z5rIx-AN5EnGvDxw.png" /><figcaption>Notifications resemble this.</figcaption></figure><h4>10. Plyer</h4><p>Plyer is an open-source library to access features commonly found in various platforms via python. It is under heavy development with the current version being 1.3.0 and provides support for Windows, MacOX, Linux, Android and iOS.</p><p>Plyer is a cross-platform library that works on mobile too when used with Kivy. Plyer has way more than just notification tools. It can do screenshots, text-to-speech, vibration, GPS, Bluetooth, audio, accelerometer, and more!</p><blockquote>It’s a tool quite similar to that of win10toast.</blockquote><pre>Command line setup for this module is :</pre><pre>pip install plyer</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc0b0eea1463ebdb4cab7a9d0419979c/href">https://medium.com/media/fc0b0eea1463ebdb4cab7a9d0419979c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*j1RJTnwfk8PrrKJcQ78fnQ.png" /></figure><h4>11. Calendar</h4><p>This module allows you to output calendars like the Unix cal program and provides additional useful functions related to the calendar.</p><p>The functions and classes defined in this module use an idealized calendar, the current Gregorian calendar extended indefinitely in both directions.</p><p>Calendar module allows output calendars like the program and provides additional useful functions related to the calendar. Functions and classes defined in Calendar module use an idealized calendar, the current Gregorian calendar extended indefinitely in both directions.</p><pre>Command line setup for this module is :</pre><pre>pip install calendar</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b212893f94509cf1f2c1dcfe21e781c/href">https://medium.com/media/6b212893f94509cf1f2c1dcfe21e781c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*0ZHBYdm4QN_h8IeAFV5YzQ.png" /><figcaption>Output for the above code snippet</figcaption></figure><h4>12. GoogleTrans</h4><p>Googletrans is a <strong>free</strong> and <strong>unlimited</strong> python library that implemented Google Translate API. This uses the <a href="https://translate.google.com/">Google Translate Ajax API</a> to make calls to such methods as detecting and translate.</p><blockquote><strong>Features:</strong></blockquote><blockquote>-Fast and reliable — it uses the same servers that translate.google.com uses</blockquote><blockquote>-Auto language detection</blockquote><blockquote>-Bulk translations</blockquote><blockquote>-Customizable service URL</blockquote><blockquote>-Connection pooling (the advantage of using requests.Session)</blockquote><blockquote>-HTTP/2 support</blockquote><blockquote>-Features</blockquote><blockquote>-Fast and reliable — it uses the same servers that translate.google.com uses</blockquote><blockquote>-Auto language detection</blockquote><blockquote>-Bulk translations</blockquote><blockquote>-Customizable service URL</blockquote><blockquote>-Connection pooling (the advantage of using requests.Session)</blockquote><blockquote>-HTTP/2 support</blockquote><pre>Command line setup for this module is :</pre><pre>pip install googletrans</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7035ab157eb88f167fa4eb5d1cc8d92e/href">https://medium.com/media/7035ab157eb88f167fa4eb5d1cc8d92e/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c6-fp0H-w8c2cblQ9CeJVQ.png" /><figcaption>English to Hindi.</figcaption></figure><h4>13. GetMac</h4><p>Pure-Python package to get the MAC address of network interfaces and hosts on the local network.</p><blockquote>It provides a platform-independent interface to get the MAC addresses of:</blockquote><blockquote>&gt;System network interfaces (by interface name)</blockquote><blockquote>&gt;Remote hosts on the local network (by IPv4/IPv6 address or hostname)</blockquote><p>MAC address also known as a physical address is the unique identifier that is assigned to the NIC (Network Interface Card) of the computer. NIC helps in connecting with a computer with other computers in the network. MAC address is unique for all the NIC’s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/1*mEZ8fIOyiQopt0s8Q5M6GA.png" /></figure><pre>Command line setup for this module is :</pre><pre>pip install getmac</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f79d82d071bef81fcc1c2da6a3bc402/href">https://medium.com/media/2f79d82d071bef81fcc1c2da6a3bc402/href</a></iframe><h4>14. WebBrowser</h4><p>The <a href="https://docs.python.org/2/library/webbrowser.html#module-webbrowser"><strong>webbrowser</strong></a> module provides a high-level interface to allow displaying Web-based documents to users. The module includes a registry of available browsers, in case multiple options are available on the system. The webbrowser module can be used to launch a browser in a platform-independent manner. It can also be controlled with the BROWSER environment variable. Under most circumstances, simply calling the <a href="https://docs.python.org/2/library/webbrowser.html#webbrowser.open"><strong>open()</strong></a> function from this module will do the right thing.</p><p>The script <strong>webbrowser</strong> can be used as a command-line interface for the module. It accepts a URL as the argument. It accepts the following optional parameters: -n opens the URL in a new browser window, if possible; -t opens the URL in a new browser page (“tab”). The options are, naturally, mutually exclusive.</p><pre>Command line setup for this module is :</pre><pre>pip install webbrowser</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/950e9d6e78c7ccdf6fbfd2de0dd4ac37/href">https://medium.com/media/950e9d6e78c7ccdf6fbfd2de0dd4ac37/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*gJPJdkJkbsIKi05NGo8oiA.png" /><figcaption>Opens tabs as per Instructions.</figcaption></figure><h4>15. Re</h4><p>A RegEx, or Regular Expression, is a sequence of characters that forms a search pattern.</p><p>RegEx can be used to check if a string contains the specified search pattern.</p><p>Python has a built-in package called re, which can be used to work with Regular Expressions.</p><p>Both patterns and strings to be searched can be Unicode strings (<a href="https://docs.python.org/3/library/stdtypes.html#str">str</a>) as well as 8-bit strings (<a href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a>). However, Unicode strings and 8-bit strings cannot be mixed: that is, you cannot match a Unicode string with a byte pattern or vice-versa; similarly, when asking for a substitution, the replacement string must be of the same type as both the pattern and the search string.</p><blockquote>The <em>re</em> module offers a set of functions that allows us to search a string for a match as shown below:</blockquote><pre>Command line setup for this module is :</pre><pre>pip install regex</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d3934d33b9b6044f44821b9080d8e96/href">https://medium.com/media/7d3934d33b9b6044f44821b9080d8e96/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kEk8eaGXrpinflkoAulo2Q.png" /><figcaption>Finds all the valid email IDs.</figcaption></figure><h4>16. Inflect</h4><p>This inflect module is used to correctly generate plurals, singular nouns, ordinals, indefinite articles; convert numbers to words. It provides plural inflections, singular noun inflections, “a”/”an” selection for English words, and manipulation of numbers as words.</p><p>It is also possible to inflect numerals (1,2,3) to ordinals (1st, 2nd, 3rd) and to English words (“one”, “two”, “three”)</p><p>The module is built around standard British spelling but is designed to cope with common American variants as well. Slang, jargon, and other English dialects are <em>not</em> explicitly catered for.</p><pre>Command line setup for this module is :</pre><pre>pip install inflect</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93b16a3c516452e5d2a4d847e4fe2dd1/href">https://medium.com/media/93b16a3c516452e5d2a4d847e4fe2dd1/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*g04gVp9LV9XdQ3t33Fvf7g.png" /><figcaption>Output of the above code snippet</figcaption></figure><h4>17. Docx2Pdf</h4><p>You can use the docx2pdf python package to bulk convert Docx to pdf. It can be used as both a CLI and a python library. It requires Microsoft Office to be installed and uses COM on Windows and AppleScript (JXA) on macOS.</p><p>Its an ugly yet quite an effective way for bulk converting Docx files to pdf</p><p>Docx is a binary file which is, unlike XLXS, not famous for being easy to integrate into your application. PDF is much easier when you care more about how a document is displayed than its abilities for further modifications.</p><pre>Command line setup for this module is :</pre><pre>pip install docx2pdf</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/057fa36962c9f47c66b0a5ab215fccd7/href">https://medium.com/media/057fa36962c9f47c66b0a5ab215fccd7/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*Qyre8owVZFEy_PYCkAqoGw.png" /><figcaption>Conversion :: SUCCESS</figcaption></figure><h4>18. Mutagen</h4><p>Mutagen is a Python module to handle audio metadata. It supports ASF, FLAC, MP4, Monkey’s Audio, MP3, Musepack, Ogg Opus, Ogg FLAC, Ogg Speex, Ogg Theora, Ogg Vorbis, True Audio, WavPack, OptimFROG, and AIFF audio files.</p><p>Mutagen aims to be an all-purpose multimedia tagging library.</p><p>Dictionary of tags in the file is generally a list of string-like values but may have additional methods available depending on tag or format. They may also be entirely different objects for certain keys, again depending on the format.</p><blockquote>Using mutagen we calculate the length of a particular .mp3 file as shown below</blockquote><pre>Command line setup for this module is :</pre><pre>pip install mutagen</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bcae50dcf0655fee542757ddeb8a8279/href">https://medium.com/media/bcae50dcf0655fee542757ddeb8a8279/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*v6Nuc5_KDMuUfsA6eSyc4Q.png" /><figcaption>Calculates and Displays length of the Song(.mp3) as per Directory.</figcaption></figure><h4>19. Platform</h4><p>The Platform module is used to retrieve as much possible information about the platform on which the program is being currently executed. Now by platform info, it means information about the device, it’s OS, node, OS version, Python version, etc. This module plays a crucial role when you want to check whether your program is compatible with the python version installed on a particular system or whether the hardware specifications meet the requirements of your program.</p><pre>It isn&#39;t required to be installed from the command prompt. Its pre-installed.</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eefe567bf70b0047447582ca13440c27/href">https://medium.com/media/eefe567bf70b0047447582ca13440c27/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*44TYesAyEmWvGHZLXNxGHQ.png" /></figure><h4>20. Gtts</h4><p>gTTS (Google Text-to-Speech), a Python library and CLI tool to interface with Google Translate’s text-to-speech API. Write spoken mp3 data to a file, a file-like object (byte string) for further audio manipulation, or stdout. Or simply pre-generate Google Translate TTS request URLs to feed to an external program.</p><p>gTTS is a very easy to use tool which converts the text entered, into audio which can be saved as an mp3 file.</p><p>The gTTS API supports several languages including English, Hindi, Tamil, French, German and many more. The speech can be delivered in any one of the two available audio speeds, fast or slow. However, as of the latest update, it is not possible to change the voice of the generated audio.</p><blockquote>Here we have an example where we convert the below string to an audio format.</blockquote><blockquote>We get to hear the declared string in the voice of someone quite fluently.</blockquote><pre>Command line setup for this module is :</pre><pre>pip install gTTS</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9a8a78027f36cba6fdddccf5bad0dca2/href">https://medium.com/media/9a8a78027f36cba6fdddccf5bad0dca2/href</a></iframe><p>&lt;The above Audio plays&gt;</p><h4>21. Selenium</h4><p>Selenium is an open-source testing tool, which means it can be downloaded from the internet without spending anything. Selenium is a functional testing tool and compatible with non-functional testing tools as well.</p><p>Selenium is one of the most popular automation testing tools. Here automation testing is a process of converting any manual test case into the test scripts using automation tools such as Selenium.</p><blockquote>Here we use selenium to automate and open <a href="http://www.python.org/">www.python.org</a></blockquote><pre>Command line setup for this module is :</pre><pre>pip install selenium</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2a690dbb22212027e948167f41f8c69/href">https://medium.com/media/b2a690dbb22212027e948167f41f8c69/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3GFZ2w2SZRnMPtP1pxzgMg.png" /><figcaption>&lt;A new Chrome Window opens&gt;</figcaption></figure><h4>22. Datetime</h4><p>A date in Python is not a data type of its own, but we can import a module named datetime to work with dates as date objects.</p><p>The datetime module supplies classes for manipulating dates and times.</p><p>While the date and time arithmetic is supported, the focus of the implementation is on efficient attribute extraction for output formatting and manipulation.</p><pre>Command line setup for this module is :</pre><pre>pip install datetime</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b38ad6174e673e60570d28e58d9a10ef/href">https://medium.com/media/b38ad6174e673e60570d28e58d9a10ef/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*Htfgksih8TGOZJKz0_73_A.png" /><figcaption>Prints as per the given commands.</figcaption></figure><h4>23. Folium</h4><p><a href="http://folium.readthedocs.io/en/latest/"><strong>Folium </strong></a>is built on the data wrangling strengths of the Python ecosystem and the mapping strengths of the Leaflet.js (JavaScript) library. Simply, manipulate your data in Python, then visualize it on a leaflet map via Folium. Folium makes it easy to visualize data that’s been manipulated in Python, on an interactive Leaflet map. This library has several built-in tilesets from OpenStreetMap, Mapbox etc.</p><pre>Command line setup for this module :</pre><pre>pip install folium</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47808bd965bba2e2153f4330783a9e8a/href">https://medium.com/media/47808bd965bba2e2153f4330783a9e8a/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qOP_Wdz-a3-ahqBRHm2iSA.png" /><figcaption>GOOGLE MAP Representation</figcaption></figure><h4>24. Wikipedia</h4><p>Wikipedia is a Python library that makes it easy to access and parse data from Wikipedia.</p><p>Search Wikipedia, get article summaries, get data like links and images from a page, and more. The Internet is the single largest source of information, and therefore it is important to know how to fetch data from various sources. And with Wikipedia being one of the largest and most popular sources for information on the Internet, this is a natural place to start.</p><p>Wikipedia wraps the MediaWiki API so you can focus on using Wikipedia data, not getting it.</p><blockquote>To extract data from Wikipedia, we must first install the Python Wikipedia library, which wraps the official Wikipedia API.</blockquote><pre>Command line setup for this module is :</pre><pre>pip install wikipedia</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5c44ec89dac7e1f59964d29b3d68009/href">https://medium.com/media/a5c44ec89dac7e1f59964d29b3d68009/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7nymtb-ToAD6GqSo-SM6AQ.png" /></figure><h4>25. SpeedTest</h4><p>Speedtest-cli is a module that is used in the command-line interface for testing internet bandwidth using speedtest.net.</p><p>It’s implemented in Python, packaged in Apt, and also available with pip. You can use it as a command-line tool or within a Python script.</p><p>This gives you your download and upload Internet speeds. It’s fast and scriptable, so you can run it regularly and save the output to a file or database for a record of your network speed over time.</p><pre>Command line setup for this module is :</pre><pre>pip install speedtest-cli</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/59721ccf95fad1fd77b02f4ea3de1a9b/href">https://medium.com/media/59721ccf95fad1fd77b02f4ea3de1a9b/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*TjJY7vomGvQ9fvDVWpeCLQ.png" /><figcaption>SpeedTest Results</figcaption></figure><p>With this, we come to the end of this Article.</p><p>Thank You for the patient read.Hope You liked it!</p><h4>Bibliography and References:</h4><ul><li><a href="http://www.python.org/">www.python.org</a></li><li><a href="http://www.pypi.org/">www.pypi.org</a></li><li><a href="http://www.w3schools.com/">www.w3schools.com</a></li><li><a href="http://www.geeksforgeeks.com/">www.geeksforgeeks.com</a></li><li><a href="http://www.stackabuse.com/">www.stackabuse.com</a></li><li><a href="http://www.tutorialspoint.com/">www.tutorialspoint.com</a></li></ul><blockquote>HAPPY CODING, HAPPY EXPLORING!!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28f1af661374" width="1" height="1" alt=""><hr><p><a href="https://medium.com/srm-mic/25-lesser-known-python-modules-that-can-improve-the-way-we-code-28f1af661374">25 Lesser-known Python Modules that can Improve the Way we Code.</a> was originally published in <a href="https://medium.com/srm-mic">SRM MIC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>