<?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 Venkata Aravind Marni on Medium]]></title>
        <description><![CDATA[Stories by Venkata Aravind Marni on Medium]]></description>
        <link>https://medium.com/@venkata-aravind-marni?source=rss-e2003f1baf30------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sgVsM5CAtG8o0lQpoT9xEw.jpeg</url>
            <title>Stories by Venkata Aravind Marni on Medium</title>
            <link>https://medium.com/@venkata-aravind-marni?source=rss-e2003f1baf30------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 17:54:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@venkata-aravind-marni/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[Setup Python Virtual Environment .]]></title>
            <link>https://venkata-aravind-marni.medium.com/setup-python-virtual-environment-92f31cff3af9?source=rss-e2003f1baf30------2</link>
            <guid isPermaLink="false">https://medium.com/p/92f31cff3af9</guid>
            <category><![CDATA[setup]]></category>
            <category><![CDATA[python-environment]]></category>
            <category><![CDATA[python-virtualenv]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Venkata Aravind Marni]]></dc:creator>
            <pubDate>Wed, 11 Jan 2023 13:00:21 GMT</pubDate>
            <atom:updated>2023-01-11T13:12:11.830Z</atom:updated>
            <content:encoded><![CDATA[<h3>Setup Python Virtual Environment .</h3><p>Create a python virtual environment to setup Django project.</p><p>A <strong>virtual environment</strong> is an isolated environment having its copy of the interpreter and libraries so that there’s no clash with the global installation of Python.</p><p>Python recommends using a virtual environment to build Python applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Kst3RGwEpCBKJKr7oRXiCQ.png" /></figure><h3>Why Are Python Virtual Environments Important?</h3><p>The importance of Python virtual environments becomes apparent when we have various Python projects on the same machine that depend on different versions of the same packages. For example, imagine working on two different data visualization projects that use the matplotlib package, one using version 2.2 and the other using version 3.5. This would lead to compatibility issues because Python cannot simultaneously use multiple versions of the same package. The other use case that magnifies the importance of using Python virtual environments is when you’re working on managed servers or production environments where you can’t modify the system-wide packages because of specific requirements.</p><p>Python virtual environments create isolated contexts to keep dependencies required by different projects separate so they don’t interfere with other projects or system-wide packages. Basically, setting up virtual environments is the best way to isolate different Python projects, especially if these projects have different and conflicting dependencies. As a piece of advice for new Python programmers, always set up a separate virtual environment for each Python project, and install all the required dependencies inside it — never install packages globally.</p><p>Steps for setting up a virtual environment.</p><p><strong>Step 1</strong> : Download the latest version of Python from the official <a href="https://www.python.org/downloads/">website</a>. and make sure to check the ‘add python to path’ check box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*cRQCmw2U0oUtnm3fDpCcKw.png" /></figure><p><strong>Step 2 </strong>: Open Command Prompt and run the following command to make sure <strong>pip</strong> is in it’s latest version. <strong>pip</strong> is the package installer for <strong>Python</strong>.</p><pre>C:\Users\admin&gt; py -m pip install - upgrade pip</pre><p><strong>Step 3</strong> : Create it</p><p>Type in python -m venv &lt;your virtual env name&gt; to create a Python virtual environment.</p><pre>C:\Users\admin\Desktop&gt; python -m venv venv</pre><p><strong>Step 4:</strong> Activate it</p><p>Great! Now your project has its own virtual environment. Generally, before you start using it, you’ll first <strong>activate</strong> the environment by executing a script that comes with the installation.</p><pre>C:\Users\admin\Desktop&gt; venv\Scripts\activate</pre><p>You’ll see (venv) . this indicates successful setup of virtual environment.</p><p>Now, the virtual environment is ready and you can install packages such as django inside the environment by moving to the virtual environment directory using cd &lt;your virtual env name&gt;</p><pre>(venv) C:\Users\admin\Desktop&gt; cd venv<br>(venv) C:\Users\admin\Desktop\venv&gt; pip3 install django</pre><p>Step 5 : Once you’re done working with this virtual environment, you can deactivate it by doing,</p><pre>(venv) C:\Users\admin\Desktop\venv&gt; deactivate</pre><p><strong><em>Thanks for reading, Follow me for more. For any suggestions, ping me on </em></strong><a href="https://www.linkedin.com/in/venkata-aravind-marni/"><strong><em>LinkedIn</em></strong></a><strong><em>.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92f31cff3af9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MVT Architecture Vs MVC Architecture, Explained WRT Django.]]></title>
            <link>https://venkata-aravind-marni.medium.com/mvt-architecture-vs-mvc-architecture-explained-wrt-django-d9d58342318c?source=rss-e2003f1baf30------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9d58342318c</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[mvt]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[mvc]]></category>
            <dc:creator><![CDATA[Venkata Aravind Marni]]></dc:creator>
            <pubDate>Sun, 08 Jan 2023 14:05:34 GMT</pubDate>
            <atom:updated>2023-01-08T14:05:34.970Z</atom:updated>
            <content:encoded><![CDATA[<p>In this Reading, you will learn about Django’s Model, View and Template (MVT) application development pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*sZEcCSlNvn-1DoJUrdWn1w.png" /></figure><h3>Web Framework</h3><p>A software framework, in general, is a standard, reusable software platform that facilitates the rapid development of software applications.</p><p>The web framework (also called web application framework) provides a generic functionality needed for building web applications, APIs and web services. The main advantage of employing a web framework for development is that it provides “out of the box” support to perform everyday operations in the web development process.</p><p>For example, you can easily connect your application to databases. Usually, the framework handles tasks such as session management much more efficiently.</p><p>Likewise, it integrates with templating tools to render dynamic content on web pages.</p><h3>MVC Architecture</h3><p>Most of the web frameworks implement the MVC (Model-View-Controller) architecture.</p><p>The MVC design pattern separates the entire web application development process into three layers, Model, View and Controller. The following diagram explains the interplay of these three layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*50B2EcJ9i2f5QjwB" /></figure><p>In the MVC approach, the controller intercepts the user requests. It coordinates with the view and model layers to send the appropriate response back to the client.</p><p>The model is responsible for data definitions, processing logic and interaction with the backend database. The view is the presentation layer of the application.</p><p>It takes care of the placement and formatting of the result and sends it to the controller, which in turn, redirects it to the client as the application’s response.</p><h3>MVT Architecture</h3><p>The Django framework adapts a Model, View and Template (MVT) approach, a slight variation of the MVC approach.</p><p>Here too, the model is the data layer of the application. The view is, in fact, the layer that undertakes the processing logic.</p><p>The template is the presentation layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rowjriXBaYsRqeKg" /></figure><p>A Django application consists of the following components:</p><ul><li>URL dispatcher</li><li>View</li><li>Model</li><li>Template</li></ul><h3>URL dispatcher</h3><p>Django’s URL dispatcher mechanism is equivalent to the controller in the MVC architecture.</p><p>The urls.py module in the Django project’s package folder acts as the dispatcher.</p><p>It defines the URL patterns. Each URL pattern is mapped with a view function to be invoked when the client’s request URL is found to be matching with it.</p><p>The URL patterns defined in each app under the project are also included. Here’s the urls.py file in the app folder.</p><pre>from django.urls import path <br>from . import views <br><br>urlpatterns = [ <br>    path(&#39;&#39;, views.index, name=&#39;index&#39;), <br>] </pre><p>When the server receives a request in the client URL, the dispatcher matches its pattern with the patterns available in the<strong> </strong>urls.py.</p><p>It then routes the flow of the application toward its associated view.</p><h3>View</h3><p>The view function reads the path, query, and body parameters included in the client’s request If required, it uses this data to interact with the models to perform CRUD operations.</p><p>A view can be a user-defined function or a class.</p><p>You create View definitions in the views.py file of the respective app package folder.</p><p>The following code in the view.py file defines the index() view function.</p><pre>from django.shortcuts import render <br># Create your views here. <br>from django.http import HttpResponse <br><br>def index(request): <br>    return HttpResponse(&quot;Hello, world.&quot;) </pre><h3>Model</h3><p>A model is a Python class.</p><p>An app may have one or more model classes, conventionally put in the models.py file.</p><p>Django migrates the attributes of the model class to construct a database table of a matching structure.</p><p>Django’s Object Relational Mapper helps perform CRUD operations in an object-oriented way instead of invoking SQL queries.</p><p>The view uses the client’s and the model’s data and renders its response using a template.</p><pre>from django.db import models<br><br># Create your models here.<br>class Menu(models.Model):<br>    name = models.CharField(max_length=100)<br>    cuisine = models.CharField(max_length=100)<br>    price = models.IntegerField()<br><br>    def __str__(self) -&gt; str:<br>        return self.name + &quot; : &quot; + self.cuisine</pre><h3>Template</h3><p>A template is a web page containing a mix of static HTML and Django Template Language code blocks.</p><p>You place Template web pages in <strong>the templates </strong>folder with the .html extension.</p><p>Django’s template processor uses any context data from the view inserted in these blocks to formulate a dynamic response.</p><p>The view, in turn, returns the response to the user.</p><p>This explains how Django’s MVT architecture handles the request-response cycle in a web application.</p><p>source: <a href="https://in.coursera.org/professional-certificates/meta-back-end-developer">link</a></p><p><strong><em>Thanks for reading, Follow me for more. For any suggestions, ping me on </em></strong><a href="https://www.linkedin.com/in/venkata-aravind-marni/"><strong><em>LinkedIn</em></strong></a><strong><em>.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9d58342318c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sending a message with an attachment using the GupShup WhatsApp API and Node.Js]]></title>
            <link>https://venkata-aravind-marni.medium.com/sending-a-message-with-an-attachment-over-the-gupshup-whatsapp-api-and-node-js-c2e4e13b4a1?source=rss-e2003f1baf30------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2e4e13b4a1</guid>
            <category><![CDATA[whatsapp]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[gupshup]]></category>
            <category><![CDATA[expressjs]]></category>
            <dc:creator><![CDATA[Venkata Aravind Marni]]></dc:creator>
            <pubDate>Tue, 03 Jan 2023 20:07:28 GMT</pubDate>
            <atom:updated>2023-01-04T16:01:51.664Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sending a message with an attachment using the GupShup WhatsApp API and Node.Js in step-by-step fashion.</h3><p>In this article, I’ll layout steps to send a WhatsApp message with an attachment with the help of GupShup WhatsApp API and Node.Js.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*9iQUAnv2q0DSmbzIU5Hnzg.png" /></figure><p><strong>STEP 1: </strong>After setting up your account, Login to<strong> </strong><a href="https://unify.smsgupshup.com/WhatsApp/Analytics/"><strong>WhatsApp Analytics by GupShup</strong></a>.</p><p><strong>STEP 2:</strong> In-order to send a message, first you need to create a template. You can do this by clicking on <strong>Create</strong> under <strong>Message Templates</strong> section in the side menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*-AmmpbZWZCGXtJsuygNyPg.png" /></figure><p><strong>STEP 3:</strong> Fill out all the details in the form and as you do you can see the preview of the message on he right tab.</p><p>Enter your Account password, template name, category, type, language, body and footer . For this example those values will be</p><p><strong>Account password</strong> : {password}</p><p><strong>Template name </strong>: Examole101</p><p><strong>Category</strong> : Transactional</p><p><strong>Type</strong> : Document</p><p><strong>Language</strong> : English(en)</p><p><strong>Body </strong>: Hi, I’m {{1}}. This is a POC to GupShup WhatsApp API. This message was sent at {{2}}.</p><p><strong>Footer</strong> : Thank you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kd2pdcdPIfd6bN0aIGvdSw.png" /></figure><p>Then, Click on <strong>Add Sample button.</strong> A pop up window will open. Fill out sample values and then press<strong> Done.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*20b5vCUQ47UszK5Gx127Bw.png" /></figure><p>Finally, click the Create button.</p><p>Go to the Templates list page from side menu and check the status of the template. If the template is in “<strong>pending</strong>” status, wait for a couple of minutes or edit your template according to WhatsApp guidelines.</p><p><strong>STEP 4</strong> : Once the template status is changed to “<strong>Enabled</strong>” Click on <strong>Test this template</strong> button under <strong>Actions.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*OABSRyGSeC69-HhuXtoDMQ.png" /></figure><p>Fill out sample values and then press<strong> Send. </strong>Then copy the API URL that pops up below. You’ll receive a message to the phone number(s) you’ve entered. If u didn’t wait for a couple of minutes and try gain.</p><p>Let’s now dive into the Node.Js code.</p><p><strong>STEP 5 </strong>: Example Code</p><p>notificationsController.js</p><pre>const mime = require(&#39;mime-types&#39;)<br>var fs = require(&#39;fs&#39;);<br><br>const GUPSHUP_USER_ID = &#39;your user id here&#39;;<br>const GUPSHUP_PASSWORD = &#39;your password here&#39;;<br><br><br>const sendWhatsappMessageWithAttachments = async (request, response) =&gt; {<br>    let root_url = request.get(&#39;host&#39;);<br>    let protocol = request.connection &amp;&amp; request.connection.encrypted ? &#39;https&#39; : &#39;http&#39;<br>    let requestObj=request.body;<br>    if (!R.isEmpty(requestObj)) {<br>        let filesData=request.files; <br>        let user_id =requestObj.user_id || &#39;&#39;<br>        let phno=requestObj.phno || null;<br>        let name =requestObj.name || &#39;&#39;<br>        let date =requestObj.date || &#39;&#39;<br>        if (!isEmpty(filesData) || !isEmpty(phno) || !isEmpty(user_id)) {<br>             //opting-in users<br>            let verifyRes=await OptInUsersForWhatsapp(phno);<br>            if (!R.isEmpty(verifyRes)) {<br>                if(verifyRes.response.status == &#39;success&#39;){<br>                    //saving file<br>                    let save_File=await saveFile(user_id,filesData);<br>                    if(!isEmpty(save_File)){<br>                        // sending WhatsApp message<br>                        let send_msg = await sendMessageViaWhatsapp(phno, save_File, root_url, protocol, name, date, user_id);<br>                        if(send_msg.response.status == &#39;success&#39;){<br>                            response.status(200).json({ &#39;status&#39;: true, &#39;message&#39;:&#39;Message sent&#39;,&#39;data&#39;:send_msg });<br>                            // deleting file after sending whatsApp message<br>                            let delete_Prescription=await deleteFile(save_File);<br>                        }<br>                        else{<br>                            response.status(200).json({ &#39;status&#39;: false, &#39;message&#39;:&#39;Sending message failed&#39; });<br>                        }<br>                    }<br>                    else{<br>                        response.status(200).json({ &#39;status&#39;: false, &#39;message&#39;:&#39;Something went wrong&#39; });<br>                    }    <br>                }else{<br>                    response.status(200).json({ &#39;status&#39;: false, &#39;message&#39;:&#39;Invalid mobile number. Please try again&#39; });<br>                }<br>            }else{<br>                response.status(200).json({ &#39;status&#39;: false, &#39;message&#39;:&#39;Something went wrong&#39; });<br>            }<br>        }else{<br>            response.status(200).json({ &quot;status&quot;: false, &quot;message&quot;: &quot;All fields are required&quot; }) <br>        } <br>    } else {<br>        response.status(200).json({ &quot;status&quot;: false, &quot;message&quot;: &quot;Data object required&quot; })<br>    }<br>}<br>const OptInUsersForWhatsapp = (phno) =&gt; {<br>    return new Promise((resolve, reject) =&gt; {  <br>        let apiUrl= &#39;http://media.smsgupshup.com/GatewayAPI/rest?method=OPT_IN&amp;format=json&amp;userid=&#39;+GUPSHUP_USER_ID+&#39;&amp;password=&#39;+GUPSHUP_PASSWORD+&#39;&amp;phone_number=&#39;+phno+&#39;&amp;v=1.1&amp;auth_scheme=plain&amp;channel=WHATSAPP&#39;;<br>        let options={<br>            url: apiUrl,<br>            method: &#39;GET&#39;,<br>            headers: {<br>                &#39;Content-Type&#39;: &#39;application/x-www-form-urlencoded&#39;<br>            }<br>        }<br>        if (!R.isEmpty(apiUrl)) {<br>            httprequest.get(options, (err, res, body) =&gt; {                              <br>                if (err) {<br>                    console.log(err)<br>                    resolve({ &quot;success&quot;: false});<br>                }else{<br>                    resolve(JSON.parse(res.body));<br>                }                <br>            });<br>        } else {<br>            resolve({ &quot;success&quot;: false});<br>        }<br>    })<br>}<br>const saveFile = (user_id, filesData) =&gt; {<br>    return new Promise((resolve, reject) =&gt; {  <br>        let files=filesData.file || [];          <br>        if(!Array.isArray(files)){<br>            let TempArr=[];<br>            TempArr.push(files)<br>            files=TempArr;   <br>        }<br>        let file=[];   <br>        if(files.length&gt;0){                <br>            for(let i=0; i&lt;files.length; i++){<br>                let path = &#39;uploads/whatsapp-docs&#39;;<br>                let fileExtension=mime.extension(files[i].mimetype)               <br>                let new_filename=user_id+&quot;.&quot;+fileExtension;<br>                let file_data=files[i];<br>                let image_name_with_path = path+&#39;/&#39;+new_filename;<br>                let absolute_path = image_name_with_path;<br>                file.push(new_filename);<br>                let file_flag = &#39;&#39;<br>                file_data.mv(absolute_path, function (err) {<br>                    if (err) {<br>                       console.log(err)<br>                    }<br>                    else {<br>                        file_flag = image_name_with_path<br>                        if(i==files.length-1){<br>                            resolve(file_flag)<br>                        }<br>                    }<br>                })                                              <br>            }                                  <br>        }            <br>    })<br>}<br>const sendMessageViaWhatsapp = (phno, image_name_with_path, root_url, protocol, name, date, user_id) =&gt; {<br>    return new Promise((resolve, reject) =&gt; {<br>        let pdf_url = protocol+&quot;://&quot;+root_url +&quot;/&quot;+ image_name_with_path;<br>        let pdf_name = &quot;Example-File-&quot;+user_id<br>        // pdf_url = &#39;https://www.africau.edu/images/default/sample.pdf&#39;<br>        let caption = &quot;Hi, I&#39;m &quot;+name+&quot;. This is a POC to Gupshup Whatsapp API. This message was sent at &quot;+date+&quot;.&quot;<br>        let apiUrl = &quot;https://media.smsgupshup.com/GatewayAPI/rest?userid=&quot;+GUPSHUP_USER_ID+&quot;&amp;password=&quot;+GUPSHUP_PASSWORD+&quot;&amp;send_to=7989029813&amp;v=1.1&amp;format=json&amp;msg_type=DOCUMENT&amp;method=SENDMEDIAMESSAGE&amp;caption=&quot;+caption+&quot;&amp;filename=&quot;+pdf_name+&quot;&amp;media_url=&quot;+pdf_url+&quot;&amp;isTemplate=true&amp;footer=Thank+you.&quot;<br>        let options={<br>            url: apiUrl,<br>            method: &#39;POST&#39;,<br>            headers: {<br>                &#39;Content-Type&#39;: &#39;application/x-www-form-urlencoded&#39;<br>            }<br>        }            <br>        if (!R.isEmpty(apiUrl)) {<br>            httprequest.get(options, (err, res, body) =&gt; {                              <br>                if (err) {<br>                    console.log(err)<br>                    resolve({ &quot;success&quot;: false});<br>                }else{<br>                    resolve(JSON.parse(body));<br>                }                <br>            });<br>        } else {<br>            resolve({ &quot;success&quot;: false});<br>        }<br>    })<br>}<br>const deleteFile = (path) =&gt; {<br>    return new Promise((resolve, reject) =&gt; {  <br>        setTimeout(() =&gt; {<br>            fs.unlink(path, (err) =&gt; {<br>                if (err){<br>                    console.log(err)<br>                    resolve(&#39;failure&#39;)<br>                } <br>                else{<br>                    resolve(&#39;success&#39;)<br>                }<br>            });<br>        }, 300000);<br>    });<br>}<br>module.exports = {<br>    sendWhatsappMessageWithAttachments<br>}</pre><p>In the above code, <strong>sendWhatsappMessageWithAttachments</strong> is responsible for opting-in users, saving the attachment, sending the message with attachment, and finally deleting the attachment from your project to save storage space.</p><p>If you need to understand uploading a file in more detail check <a href="https://medium.com/@venkata-aravind-marni/upload-single-multiple-files-using-node-js-express-2c4bd7f85af7"><strong>this</strong></a> out.</p><p>routes.js</p><pre>const express = require(&quot;express&quot;);<br>const router = express.Router();<br>const notificationsController = require(&#39;../controllers/notificationsController&#39;);<br><br>router.post(&quot;/sendWhatsappMessageWithAttachments&quot;, notificationsController.sendWhatsappMessageWithAttachments);<br><br>module.exports = router;</pre><p><strong>STEP 6: </strong>Check the Code using postman. The<strong> Request</strong> and <strong>Response</strong> will be as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*4o1IWkH5kdzDBholKeIrNA.png" /><figcaption>request</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*LDfOhvH_AEEBByaCEUQGxg.png" /><figcaption>response</figcaption></figure><p>I wrote the code in a way that it is self-explanatory and you can easily understand what is going on.</p><p>If you have any further doubts, checkout the <a href="https://enterprise.smsgupshup.com/doc/GatewayAPIDoc.pdf"><strong>documentation</strong></a> provided by GupShup for more information.</p><blockquote><strong>Thanks for reading, Follow me for more. For any suggestions, ping me on </strong><a href="https://www.linkedin.com/in/venkata-aravind-marni/"><strong>LinkedIn</strong></a><strong>.</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2e4e13b4a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Upload Single/Multiple Files using Node.js Express]]></title>
            <link>https://venkata-aravind-marni.medium.com/upload-single-multiple-files-using-node-js-express-2c4bd7f85af7?source=rss-e2003f1baf30------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c4bd7f85af7</guid>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[file-upload]]></category>
            <category><![CDATA[swagger]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[postman]]></category>
            <dc:creator><![CDATA[Venkata Aravind Marni]]></dc:creator>
            <pubDate>Tue, 03 Jan 2023 08:53:43 GMT</pubDate>
            <atom:updated>2023-01-03T08:53:43.736Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IijpInmMl8JsKiqGQD1pwg.png" /></figure><p>In this article, we are going learn how to upload single/multiple files in node.js (express).</p><p><strong>Request:</strong></p><p>This API takes multiple files along with optional data as request data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*sHhtfR-bVQQI7uJf2eGUQQ.png" /><figcaption>postman</figcaption></figure><p><strong>Response:</strong></p><p>The output of this API consists of paths of all files uploaded in an array.</p><pre>{<br>    &quot;status&quot;: true,<br>    &quot;message&quot;: &quot;Files uploaded&quot;,<br>    &quot;data&quot;: [<br>        &quot;uploads/form_files/form1_dpeO2h1e.png&quot;,<br>        &quot;uploads/form_files/form1_5AmJcgbd.png&quot;<br>    ]<br>}</pre><p>Once you have the path for files you can easily get the URL of those files as shown below</p><pre>let root_url = request.get(&#39;host&#39;);<br>let protocol = request.connection &amp;&amp; request.connection.encrypted ? &#39;https&#39; : &#39;http&#39;<br>let pdf_url = protocol+&quot;://&quot;+root_url +&quot;/&quot;+ path_of_file;</pre><p><strong>Complete</strong> <strong>Code</strong>:</p><p><em>imageUploadController.js</em></p><pre>const mime = require(&#39;mime-types&#39;)<br><br><br>const imageUpload = async (request, response) =&gt; {<br>    let requestObj=request.body;  <br>    let filesData=request.files;    <br>    if (!R.isEmpty(filesData) &amp;&amp; !R.isEmpty(requestObj)) {<br>        let form_id = requestObj.form_id || null<br>        let save_file=await saveFiles(form_id, filesData); <br>        if(!isEmpty(save_file)){<br>            response.status(200).json({ &#39;status&#39;: true, &#39;message&#39;:&#39;Files uploaded&#39;,&#39;data&#39;:save_file });<br>        }else{<br>            response.status(200).json({ &quot;status&quot;: false, &quot;message&quot;: &quot;Somehing went wrong&quot; })<br>        }            <br>    } else {<br>        response.status(200).json({ &quot;status&quot;: false, &quot;message&quot;: &quot;Data object required&quot; })<br>    }<br>}<br>const saveFiles = (form_id,filesData) =&gt; {<br>    return new Promise((resolve, reject) =&gt; {  <br>        let files=filesData.file || []; <br>        if(!Array.isArray(files)){<br>            let TempArr=[];<br>            TempArr.push(files)<br>            files=TempArr;   <br>        }<br>        let file=[];   <br>        if(files.length&gt;0){          <br>            let response_files = []      <br>            for(let i=0; i&lt;files.length; i++){<br>                let path = &#39;uploads/form_files&#39;; //path where you want to save your files<br>                let string = randomString(8, &#39;0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&#39;);<br>                let rString = form_id + &#39;_&#39; + string;<br>                let fileExtension=mime.extension(files[i].mimetype)<br>                let new_filename=rString+&quot;.&quot;+fileExtension; //generating a unique name for ur file<br>                let file_data=files[i];<br>                let image_name_with_path = path+&#39;/&#39;+new_filename;<br>                let absolute_path = image_name_with_path;<br>                file.push(new_filename);<br>                let file_flag = &#39;&#39;<br>                file_data.mv(absolute_path, function (err) { //uploding file<br>                    if (err) {<br>                       console.log(err)<br>                    }<br>                    else {<br>                        file_flag = image_name_with_path<br>                        response_files.push(file_flag)<br>                        if(i==files.length-1){<br>                            resolve(response_files)<br>                        }<br>                    }<br>                })                                              <br>            }                                  <br>        }            <br>    })<br>}<br>function randomString(length, chars) {<br>    var result = &#39;&#39;;<br>    for (var i = length; i &gt; 0; --i) result += chars[Math.floor(Math.random() * chars.length)];<br>    return result;<br>}<br><br>module.exports = {<br>imageUpload<br>}</pre><p><em>routes.js</em></p><pre>const express = require(&quot;express&quot;);<br>const router = express.Router();<br>const imageUploadController = require(&#39;../controllers/imageUploadController&#39;);<br><br>router.post(&quot;/imageUpload&quot;, imageUploadController.imageUpload);<br><br>module.exports = router;</pre><p><strong>Thanks For Reading, Follow Me For More.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c4bd7f85af7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Science Job Salaries — Explanatory Data Analysis(EDA)]]></title>
            <link>https://venkata-aravind-marni.medium.com/data-science-job-salaries-explanatory-data-analysis-eda-9f3da7df7723?source=rss-e2003f1baf30------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f3da7df7723</guid>
            <category><![CDATA[data-science-job]]></category>
            <category><![CDATA[salary]]></category>
            <category><![CDATA[eda]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-engineer]]></category>
            <dc:creator><![CDATA[Venkata Aravind Marni]]></dc:creator>
            <pubDate>Sun, 04 Sep 2022 08:07:34 GMT</pubDate>
            <atom:updated>2022-09-04T08:13:21.320Z</atom:updated>
            <content:encoded><![CDATA[<h3>Data Science Job Salaries — Explanatory Data Analysis(EDA)</h3><h3>What is exploratory data analysis?</h3><p>Exploratory data analysis (EDA) is used by data scientists to analyze and investigate data sets and summarize their main characteristics, often employing data visualization methods. It helps determine how best to manipulate data sources to get the answers you need, making it easier for data scientists to discover patterns, spot anomalies, test a hypothesis, or check assumptions.</p><p>For this notebook I used the below data from kaggle to perform Explanatory Data Analysis(EDA) to find out hidden insights in the data.</p><p><a href="https://www.kaggle.com/datasets/ruchi798/data-science-job-salaries">Data Science Job Salaries</a></p><p>I imported the data into the notebook and fortunately, the data is already cleaned. So, I jumped right into EDA step.</p><p>I performed Univariate and Multivariate analysis on the fields of the data. I used pandas, numpy, matplotlib and other packages to collect, process, analyze and visualize data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uYlHzs_-oqYlcWJhXAflow.jpeg" /></figure><p>A detailed step-by step process given in the notebook below.</p><p>Just download the notebook file and run it in <a href="https://jupyter.org/">Jupyter</a> or <a href="https://colab.research.google.com/">Google Colab</a> to view the code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1430dce0d14ae9c3d8671879579c8869/href">https://medium.com/media/1430dce0d14ae9c3d8671879579c8869/href</a></iframe><p>You can also access my code from my git repository by clicking <a href="https://github.com/venkata-aravind-marni/data-science-job-salaries-eda">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f3da7df7723" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Scraping IMDB ratings of all episodes of a TV series]]></title>
            <link>https://venkata-aravind-marni.medium.com/web-scraping-imdb-ratings-of-all-episodes-of-a-series-db457cfb62b?source=rss-e2003f1baf30------2</link>
            <guid isPermaLink="false">https://medium.com/p/db457cfb62b</guid>
            <category><![CDATA[beautifulsoup]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[better-call-saul]]></category>
            <dc:creator><![CDATA[Venkata Aravind Marni]]></dc:creator>
            <pubDate>Tue, 30 Aug 2022 10:27:07 GMT</pubDate>
            <atom:updated>2022-08-30T16:07:37.368Z</atom:updated>
            <content:encoded><![CDATA[<p>I found a tonne of tutorials on the internet to scrape movie ratings from IMDB but I haven’t found any about scraping episode ratings of all Seasons of a TV series.</p><p>So, I’m writing this to make your life easier.</p><p>In this tutorial we’ll learn to scrape multiple web pages with Python using <strong>BeautifulSoup</strong> and <strong>requests</strong> to get IMDB data from all seasons of Better Call Saul. We’ll then perform some simple analysis using pandas, and matplotlib.</p><p>For this tutorial I choose to scrape the IMDB reviews of the series <a href="https://www.imdb.com/title/tt3032476/episodes?season=1">Better Call Saul</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*WAVCqYUhfoKi73RNgaitFg.jpeg" /><figcaption>I had to do it</figcaption></figure><p>A detailed step-by step process of collecting data by web scrapping, then cleaning, analyzing and visualizing data is added in the notebook below.</p><p>Just download the notebook file and run it in <a href="https://jupyter.org/">Jupyter</a> or <a href="https://colab.research.google.com/">Google Colab</a> to view the detailed tutorial.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b67153fb9b74a42b6e9e58f5b4da4bb0/href">https://medium.com/media/b67153fb9b74a42b6e9e58f5b4da4bb0/href</a></iframe><p>You can also access my code from my git repository by clicking <a href="https://github.com/venkata-aravind-marni/Breaking-down-Better-call-Saul-IMDB-ratings-data">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db457cfb62b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selenium Automation Testing with Page Object Model(POM) using Python -POC]]></title>
            <link>https://venkata-aravind-marni.medium.com/selenium-automation-testing-with-page-object-model-pom-using-python-poc-5ca80e61a4d0?source=rss-e2003f1baf30------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ca80e61a4d0</guid>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[page-object-model]]></category>
            <category><![CDATA[selenium-webdriver]]></category>
            <category><![CDATA[poc]]></category>
            <dc:creator><![CDATA[Venkata Aravind Marni]]></dc:creator>
            <pubDate>Mon, 29 Aug 2022 15:00:05 GMT</pubDate>
            <atom:updated>2022-08-29T15:01:08.306Z</atom:updated>
            <content:encoded><![CDATA[<h4>Selenium WebDriver</h4><p>Selenium WebDriver is <strong>a web framework that permits you to execute cross-browser tests</strong>. This tool is used for automating web-based application testing to verify that it performs expectedly. Selenium WebDriver allows you to choose a programming language to create test scripts.</p><p>You can find the code from my GitHub repository link <a href="https://github.com/venkata-aravind-marni/Selenium-PageObjectModel-POC">here</a>.</p><h4>Steps:</h4><ol><li>Download <a href="https://www.python.org/downloads/">Python</a></li><li>Download <a href="https://www.jetbrains.com/pycharm/download/#section=windows">Pycharm</a> community</li><li>Edit system environmental variables -&gt;system variables -&gt; path -&gt; edit C:\Users\ARAVIND\AppData\Local\Programs\Python\Python38 C:\Users\ARAVIND\AppData\Local\Programs\Python\Python38\Scrip</li><li>Create python project in Pycharm</li><li>Run these commands in terminal</li></ol><pre>pip install selenium<br>pip install webdriver-manager //for managing web driver <br>pip install openpyxl //for managing excel data <br>pip install schedule // for scheduling tasks to run at a particular date and time <br>pip install smtplib // for sending email <br>pip install allure-pytest <br>pip install pytest <br>pip install unittest <br>pip install python-dotenv // for setting up .env file. <br>pip install prettytable // for generating html tables</pre><p>If you choose visual studio as your go to editor, then download python in visual studio code and run the above commands after creating a project</p><h4>What is Page Object Model(POM)?</h4><p>Page Object Model is a design pattern that is used mostly in Web UI testing for enhancing maintenance of the test code and reducing duplication of it. Each page in the web application has to be separate class different than the others. These are the classes that contain Web Elements(Locators) of the web page, the classes include the methods which perform operations on those Web Elements and the classes are exist so that to execute corresponding page tests.</p><h4>Folder structure: POM</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/1*JXmseUngztjRnL46eKk0iw.png" /><figcaption>POM folder structure</figcaption></figure><p>The <strong>Base</strong> folder consists of base.py and excel.py files .</p><p><strong>Base.py</strong> consists of the parent class Base whose features and functionalities are inherited in is inherited in the Test cases in files located in Test/Scripts.It consists of code for handling browsers(opening, closing) and loading excel workbooks. We can also add functions of code that we intent to use in child classes. I added a function for generating email which is called with exception details as arguments in test script classes when an exception occurred during running of scripts.</p><p><strong>Excel.py</strong> consists of code to loading excel workbooks and code to make sure the results for the test cases we ran are recorded in the excel. For more info on how to read or write data from excel visit this <a href="https://openpyxl.readthedocs.io/en/stable/tutorial.html">link</a>.</p><p>The <strong>media</strong> folder consists of screenshots we took using webdriver.</p><p>The <strong>Test/Scripts</strong> folder consists of files for test cases for each page of our application. Each of those files consists of a class which inherits features from parent class in Base/Base.py file. In side those classes we write functions for test cases. It is important to start the function name with test_ . The code for test cases is located in try block. This is done to prevent breakage in flow of execution of test cases. We store the result of test case in the respective sheet of excel file and dictionary variable. In case of an exception, the program control is passed to Except block where we record exception details, take a screenshot where the exception has occurred and share those details by calling mail function present in base.py file.</p><p>For more info on how to locating html elements visit this <a href="https://selenium-python.readthedocs.io/locating-elements.html">link.</a></p><p>The locators required for test scripts are located in <strong>Src/PageObjects/locator.py</strong> file. We store locators as variables and we import this file in test scripts files and use variables to locate html elements on web page.</p><p>We can run multiple test cases at once by using Test suites. These test suites are located in <strong>TestSuite/TestRunner.py file.</strong> In this file we import all the test case classes from Test/Scripts and load those test cases using unittest.TestLoader(). Then we create a test suite and we run that test suite. We can also schedule our tasks at a particular date and time in this file.</p><p>I included the <strong>.env </strong>file in the project folder. I t consists of variables that I consistently use throughout the program like base_url.</p><p>We can use the contents of .env file by using the following sniplet.</p><pre>from dotenv import load_dotenv <br>load_dotenv() <br>os.getenv(&#39;base_url&#39;)</pre><p>The var.py file consists of array and dictionary datatype variables require to generate test report that is sent via mail to the users. The Test Report mail functionality is present in <strong>Test/Scripts/test_results_mail.py</strong> file.</p><p>The excel sheet that contains input data for forms and used to store Test results is present in project folder with name <strong>member.xlsx.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ca80e61a4d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>