<?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 Nancy Khullar on Medium]]></title>
        <description><![CDATA[Stories by Nancy Khullar on Medium]]></description>
        <link>https://medium.com/@nancy-khullar97?source=rss-dbb35f3d8cc0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CjwoaLszPT5NGew_7oFfzw@2x.jpeg</url>
            <title>Stories by Nancy Khullar on Medium</title>
            <link>https://medium.com/@nancy-khullar97?source=rss-dbb35f3d8cc0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 15:19:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nancy-khullar97/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[PEP8:
CODING STYLE IN PYTHON]]></title>
            <link>https://nancy-khullar97.medium.com/pep8-coding-style-in-python-c90c3407768f?source=rss-dbb35f3d8cc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/c90c3407768f</guid>
            <category><![CDATA[coding-style]]></category>
            <category><![CDATA[writetogrow]]></category>
            <dc:creator><![CDATA[Nancy Khullar]]></dc:creator>
            <pubDate>Wed, 23 Dec 2020 12:52:33 GMT</pubDate>
            <atom:updated>2020-12-23T13:15:43.627Z</atom:updated>
            <content:encoded><![CDATA[<h3>Coding style in Python</h3><h3>INTRODUCTION</h3><p>Indeed coding and applying logic is the foundation of any programming language but there’s also another factor that every coder must keep in mind while coding and that is the coding style.</p><p>Keeping this in mind, Python maintains a strict way of order and format of scripting.Following this sometimes mandatory and is a great help on the user’s end, to understand. Making it easy for others to read code is always a good idea, and adopting a nice coding style helps tremendously for that.</p><p>For Python, <strong>PEP 8</strong> has emerged as the style guide that most projects adhere to; it promotes a very readable and eye-pleasing coding style. Every Python developer should read it at some point; here are the most important points extracted for you:</p><p><strong>1. Use 4-space indentation and no tabs.</strong></p><p>Examples:</p><pre><strong># Aligned with opening delimiter.</strong><br>grow = function_name(variable_one, variable_two,<br>                     variable_three, variable_four)</pre><pre><strong># First line contains no argument. Second line onwards<br># more indentation included to distinguish this from <br># the rest.</strong><br>def function_name(<br>        variable_one, variable_two, variable_three,<br>        variable_four):<br>    print(variable_one)# Aligned with opening delimiter.</pre><p>The 4 space rule is not always mandatory and can be overruled for continuation line.</p><p><strong>2. Use docstrings :</strong></p><p>There are both single and multi-line docstrings that can be used in Python. However, the single line comment fits in one line, triple quotes are used in both cases. These are used to define a particular program or define a particular function.</p><p>Example:</p><pre>def exam():<br>    &quot;&quot;&quot;This is single line docstring&quot;&quot;&quot;<br><br>    &quot;&quot;&quot;This is<br>    a<br>    multiline comment&quot;&quot;&quot;</pre><p><strong>3. Wrap lines so that they don’t exceed 79 characters : </strong>The Python standard library is conservative and requires limiting lines to 79 characters. The lines can be wrapped using<strong><em> parenthesis, brackets, and braces.</em></strong> They should be used in preference to backslashes.</p><p>Example:</p><pre>with open(&#39;/path/from/where/you/want/to/read/file&#39;) as file_one, \<br>     open(&#39;/path/where/you/want/the/file/to/be/written&#39;, &#39;w&#39;) as file_two:<br>    file_two.write(file_one.read())</pre><p><strong>4. Use of regular and updated comments are valuable to both the coders and users</strong> :</p><p>If a comment is a full sentence, its first word should be capitalized, unless it is an identifier that begins with a lowercase letter.</p><p>In short comments, the period at the end can be omitted.</p><p>In block comments, there are more than one paragraph and each sentence must end with a period. Block comments and inline comments can be written followed by a single ‘#’.</p><p>Example of inline comments:</p><pre>geek = geek + 1                 # Increment</pre><p><strong>5. Use of trailing commas :</strong> This is not mandatory except while making a tuple.</p><p>Example:</p><pre>tup = (&quot;geek&quot;,)</pre><p>5.<strong> Use Python’s default <em>UTF-8</em> or <em>ASCII</em> encodings and not any fancy encodings</strong>, if it is meant for international environment.</p><p><strong>6. Use spaces around operators and after commas, but not directly inside bracketing constructs:</strong></p><pre>a = f(1, 2) + g(3, 4)</pre><p><strong>7. Naming Conventions :</strong></p><p>There are few naming conventions that should be followed in order to make the program less complex and more readable. At the same time, the naming conventions in Python are a bit of a mess, but there are few conventions that can be followed easily.</p><p>There is an overriding principle that follows that the names that are visible to the user as public parts of API should follow conventions that reflect usage rather than implementation.</p><p>Here are few other naming conventions:</p><ul><li><strong>b (single lowercase letter)</strong></li><li><strong>B (single upper case letter)</strong></li><li><strong>Lowercase</strong></li><li><strong>Lower_case_with_underscores</strong></li><li><strong>UPPERCASE</strong></li><li><strong>UPPER_CASE_WITH_UNDERSCORES</strong></li><li><strong>CapitalizedWords (or CamelCase). This is also sometimes known as StudlyCaps.</strong></li><li><strong>Note: While using abbreviations in CapWords, capitalize all the letters of the abbreviation. Thus HTTPServerError is better than HttpServerError.</strong></li><li><strong>mixedCase (differs from CapitalizedWords by initial lowercase character!)</strong></li><li><strong>Capitalized_Words_With_Underscores</strong></li></ul><p>In addition to these few leading or trailing underscores are also considered.</p><p>Examples:</p><ol><li><strong>single_leading_underscore: </strong>weak “internal use” indicator. <strong>E.g. from M import *</strong> does not import objects whose name starts with an underscore.</li><li><strong>single_trailing_underscore_:</strong> used to avoid conflicts with Python keywords.</li></ol><pre>Example: Tkinter.Toplevel(master, class_=&#39;ClassName&#39;)</pre><p>3.<strong> __double_leading_underscore:</strong> when naming a class attribute, invokes name mangling.</p><pre>Example: (inside class FooBar, __boo becomes _FooBar__boo;)</pre><p>4.<strong> __double_leading_and_trailing_underscore__: </strong>“magic” objects or attributes that live in user-controlled namespaces.</p><pre>Example: <em> __init__, __import__ or __file__</em>. <br>Only use them as documented.</pre><p><strong>8. Characters that should not be used for identifiers :</strong></p><p>‘l’ (lowercase letter el), ‘O’ (uppercase letter oh), or ‘I’ (uppercase letter eye) as single character variable names as these are similar to the numerals one and zero.</p><p><strong>9. Don’t use non-ASCII characters in identifiers :</strong></p><p>if there is only the slightest chance people speaking a different language will read or maintain the code.</p><p><strong>10. Name your classes and functions consistently :</strong></p><p>The convention is to use <strong>CamelCase</strong> for classes and <strong>lower_case_with_underscores</strong> for functions and methods. Always use <strong>self</strong> as the name for the first method argument.</p><p><strong>11. While naming the function of methods always use <em>self</em> for the first argument</strong> to instance methods and <em>cls</em> for the first argument to class methods.If a function’s argument name matches with reserved words then it can be written with a trailing comma. <strong>For e.g., class_</strong></p><p>You can refer to this simple program to know how to write an understandable code:</p><pre># Python program to find the # factorial of a number provided by the user.</pre><pre># change the value for a different result</pre><pre>num = 7</pre><pre># uncomment to take input from the user</pre><pre>#num = int(input(“Enter a number: “))</pre><pre>factorial = 1</pre><pre># check if the number is negative, positive or zero</pre><pre>if num &lt; 0:</pre><pre>print(“Sorry, factorial does not exist for negative num”)</pre><pre>elif num == 0:</pre><pre>print(“The factorial of 0 is 1”)</pre><pre>else:</pre><pre>for i in range(1,num + 1):</pre><pre>factorial = factorial*i</pre><pre>print(“The factorial of”,num,”is”,factorial)</pre><pre><strong>Output:</strong></pre><pre>The factorial of 7 is 5040</pre><p>Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c90c3407768f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[In-app billing with RTDN- Python!!]]></title>
            <link>https://nancy-khullar97.medium.com/in-app-billing-with-rtdn-python-6692d1ed22a8?source=rss-dbb35f3d8cc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6692d1ed22a8</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[in-app-purchase]]></category>
            <dc:creator><![CDATA[Nancy Khullar]]></dc:creator>
            <pubDate>Wed, 09 Sep 2020 14:25:36 GMT</pubDate>
            <atom:updated>2020-09-09T14:31:51.991Z</atom:updated>
            <content:encoded><![CDATA[<p>-<em>By Nancy Khullar</em></p><p><strong><em>What is Real-time developer notification (RTDN)?</em></strong></p><p>“Real-time developer notifications (RTDN) is a mechanism to receive notifications from Google whenever there is a change in a user’s entitlement within your app. RTDN leverages the <strong>use of </strong><a href="https://cloud.google.com/pubsub/docs/overview"><strong>Google Cloud Pub/Sub</strong></a><strong>, </strong>which allows you to receive data that is either pushed to a URL that you set or is polled using a <a href="https://cloud.google.com/pubsub/docs/reference/libraries">client library</a>. These notifications <strong><em>allow you to react immediately to subscription state changes</em></strong>, avoiding the need to poll the Google Play Developer API. Note that inefficient use of the Google Play Developer API can lead to API quota restrictions.</p><p><strong><em>Why am I understanding this?</em></strong></p><p>You must have used in-app purchase in your appllications.<em> </em><strong><em>Have you ever wondered what will happen if a user step put of your application and cancels the subscription?? How will you know that there are some changes at subscription??</em></strong></p><p>So, this is all about we are going to study today!!</p><p><strong><em>Let’s Begin!</em></strong><em>!</em> Let’s look at a basic flow first..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0BXq1Iu1J8ZiKFuD0cSJ-Q.jpeg" /></figure><p>Don’t worry !! It might seem difficuly but it isn’t !!</p><p>We will covering the <strong>Backend</strong> part here. For setting up the frontend, you can refer the below links!!</p><p><strong><em>Reference link for IAB</em></strong>: <a href="https://blog.mindorks.com/implement-in-app-purchases-in-android">https://blog.mindorks.com/implement-in-app-purchases-in-android</a></p><p><strong><em>Reference link for RTDN:</em></strong><a href="https://developer.android.com/google/play/billing/getting-ready#configure-rtdn">https://developer.android.com/google/play/billing/getting-ready#configure-rtdn</a></p><blockquote><strong>BACKEND : PYTHON</strong></blockquote><h3><strong>Step1:</strong></h3><p><em>Create a POST/PUT Api for saving purchase token and subscription details in database.</em></p><p><strong>Models.py</strong></p><pre>is_subscribed = models.BooleanField(‘Subscribed User’, default=False)</pre><pre>subscription_start = models.DateTimeField(verbose_name=’Subscription Start’, null=True, blank=True)</pre><pre>subscription_end = models.DateTimeField(verbose_name=’Subscription End’, null=True, blank=True)</pre><pre>purchase_token = models.TextField(null=True,blank=True)</pre><p><strong>Urls.py</strong></p><pre>urlpatterns = [</pre><pre>path(‘updatepurchasetoken/’, views.UpdatePurchaseToken.as_view(), name=’update purchase token’),<br>]</pre><p><strong>Views.py</strong></p><pre><em>class</em> <strong>UpdatePurchaseToken</strong>(APIView):<br>      permission_classes = (IsAuthenticated,)</pre><pre>      <em>def</em> <strong>put</strong>(self,request,*args,**kwargs):<br>          user = request.user<br>          user_obj = User.objects.filter(id=user.id).first()</pre><pre>          if <strong><em>not</em></strong> <strong>user_obj</strong>:<br>              <strong>return</strong> Response(get_custom_error_message<br>             (message=&#39;User not Found&#39;,status=404),status=404)</pre><pre>          purchase_token = request.data.get(&quot;purchase_token&quot;)<br>          <strong><em>#here,we have 1 year subscription</em></strong>          <br>          subscription_start = datetime.now()<br>          subscription_end = datetime.now() + timedelta(<strong>days</strong>=365)</pre><pre>          if <strong><em>not</em></strong> <strong>purchase_token</strong>:<br>              <strong>raise</strong> CustomApiException(status_code=400,<br>                    message=&quot;Kindly provide purchase token&quot;,<br>                    location=&quot;Update purchase token&quot;)</pre><pre>          <strong><em>#updating database<br>          </em></strong>User.objects.filter(id=user.id).<br>          update(purchase_token=purchase_token,is_subscribed=True,<br>          subscription_start=subscription_start,<br>          subscription_end=subscription_end)</pre><pre>return <strong>Response</strong>({&quot;message&quot;:&quot;Data saved successfully&quot;})</pre><p><strong>Request body : </strong>(<em>Written dummy token for example only, frontend will provide you actual one. It will be a base64encoded string)</em></p><pre>{<br>“purchase_token”: ”mhldcgpkaidcohgeojncfjab.AO-J1Oxy0FpNSzhfdkhfdlskfldhkfldlksfjsa7HY5pGA7euLoC-u6UetycGOGVCIiQhiGWVFCajlflasfflaDQh1K5d05AKcM1ixjW3-hlgAvd5lMJwGdrp53RyJDQJjEtbKL0yusMAWKCQRKZdO3bPC2OIY5pFPrhYFLHqpZDYpkA”<br>}</pre><h3><strong>Step 2</strong></h3><p><em>Create a webhook that will be triggered at google play for different notifications. Here we will handle 2 notification types — Renewal and Expired.</em></p><p><strong><em>Total Notification types:</em></strong></p><ul><li>(1) SUBSCRIPTION_RECOVERED — A subscription was recovered from account hold.</li><li><strong>(2) SUBSCRIPTION_RENEWED — An active subscription was renewed.</strong></li><li>(3) SUBSCRIPTION_CANCELED — A subscription was either voluntarily or involuntarily cancelled. For voluntary cancellation, sent when the user cancels.</li><li>(4) SUBSCRIPTION_PURCHASED — A new subscription was purchased.</li><li>(5) SUBSCRIPTION_ON_HOLD — A subscription has entered account hold (if enabled).</li><li>(6) SUBSCRIPTION_IN_GRACE_PERIOD — A subscription has entered grace period (if enabled).</li><li>(7) SUBSCRIPTION_RESTARTED — User has reactivated their subscription from Play &gt; Account &gt; Subscriptions (requires opt-in for subscription restoration).</li><li>(8) SUBSCRIPTION_PRICE_CHANGE_CONFIRMED — A subscription price change has successfully been confirmed by the user.</li><li>(9) SUBSCRIPTION_DEFERRED — A subscription’s recurrence time has been extended.</li><li>(10) SUBSCRIPTION_PAUSED — A subscription has been paused.</li><li>(11) SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED — A subscription pause schedule has been changed.</li><li>(12) SUBSCRIPTION_REVOKED — A subscription has been revoked from the user before the expiration time.</li><li><strong>(13) SUBSCRIPTION_EXPIRED — A subscription has expired.</strong></li></ul><p><strong>Request Body:</strong></p><p>Each publish made to a Cloud Pub/Sub topic contains a single base64-encoded data field.</p><pre>{<br>  &quot;message&quot;: {<br>    &quot;attributes&quot;: {<br>      &quot;key&quot;: &quot;value&quot;<br>    },<br>    &quot;data&quot;: &quot;eyAidmVyc2lvbiI6IHN0cmluZywgInBhY2thZ2VOYW1lIjogc3RyaW5nLCAiZXZlbnRUaW1lTWlsbGlzIjogbG9uZywgIm9uZVRpbWVQcm9kdWN0Tm90aWZpY2F0aW9uIjogT25lVGltZVByb2R1Y3ROb3RpZmljYXRpb24sICJzdWJzY3JpcHRpb25Ob3RpZmljYXRpb24iOiBTdWJzY3JpcHRpb25Ob3RpZmljYXRpb24sICJ0ZXN0Tm90aWZpY2F0aW9uIjogVGVzdE5vdGlmaWNhdGlvbiB9&quot;,<br>    &quot;messageId&quot;: &quot;136969346945&quot;<br>  },<br>  &quot;subscription&quot;: &quot;projects/myproject/subscriptions/mysubscription&quot;<br>}</pre><p><strong>Urls.py</strong></p><pre>urlpatterns = [</pre><pre>...<br>path(‘webhook/’, views.UpdateSubscriptionWebhook.as_view(), name=’edit-my-subscription-webhook’),</pre><pre>]</pre><p><strong>Views.py</strong></p><pre><em>class</em> <strong>UpdateSubscriptionWebhook</strong>(APIView):</pre><pre>      <em>def</em> <strong>put</strong>(self,request,*args,**kwargs):<br>          message = request.data.get(&quot;message&quot;)<br>          data = message.get(&quot;data&quot;)<br>          response = <strong>payment_on_android</strong>(data)<br>          return Response(response)</pre><p><strong>Utils.py : </strong><em>I have written function here for performing logic</em></p><pre><em>def</em> <strong>payment_on_android</strong>(data):<br>    <br>    <strong>&quot;&quot;&quot;<br>    method used to authenticate payment through the google.<br>    &quot;&quot;&quot;</strong></pre><pre><strong><em>   try:<br>      </em></strong>import ast<br>      decoded_data = base64.b64decode(data)<br>      decoded_data = decoded_data.decode(&#39;UTF-8&#39;)<br>      decoded_data = json.loads(decoded_data)<br>      subscription_obj = decoded_data[&quot;subscriptionNotification&quot;]     <br>      purchase_token = subscription_obj[&quot;purchaseToken&quot;]<br>      notification_type = subscription_obj[&quot;notificationType&quot;]</pre><pre>      <strong><em>#Fetch all user objects that have this purchase token(Many to<br>      one relationship as there might be a case that same   <br>      subscription being used by different users) </em></strong></pre><pre><strong><em>      </em></strong>queryset= User.objects.filter(purchase_token=purchase_token)<br>              .all()<br>      if <strong>queryset</strong>:<br>         if notification_type == 3:<br>            <em>&quot;&quot;&quot;for renewal&quot;&quot;&quot;<br>            </em>for <em>obj</em> in <strong>queryset</strong>:<br>                obj.subscription_end = obj.subscription_end <br>                                      + timedelta(days=365)<br>                obj.save()</pre><pre>         elif notification_type == 13:<br>             <em>&quot;&quot;&quot;for expiry&quot;&quot;&quot;<br>            </em>for <em>obj</em> in <strong>queryset</strong>:<br>                obj.subscription_end = datetime.now()<br>                is_subscribed = False</pre><pre>      else:<br>         <strong><em>raise</em></strong> CustomApiException(status_code=400,<br>               message=&#39;Invalid purchase token&#39;,<br>               location =&#39;webhook&#39;)</pre><pre>    <strong><em>except:<br>          raise</em></strong> CustomApiException(status_code=400,<br>                message=&#39;Some error occured. Kindly try<br>                again!&#39;,location = &#39;webhook&#39;)<br>  <strong>return</strong> True</pre><p>And, we are done!</p><p>Stay tuned for ios too..</p><p><em>Thanks!!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6692d1ed22a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Django push notifications- FCM,PyFcm,txFcm??]]></title>
            <link>https://nancy-khullar97.medium.com/django-push-notifications-fcm-pyfcm-txfcm-57e3c22db52b?source=rss-dbb35f3d8cc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/57e3c22db52b</guid>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[notifications]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Nancy Khullar]]></dc:creator>
            <pubDate>Mon, 10 Aug 2020 22:42:29 GMT</pubDate>
            <atom:updated>2020-08-10T23:44:08.563Z</atom:updated>
            <content:encoded><![CDATA[<p>-Nancy Khullar</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*NiqeqCQuWHnE3QAkbQ0feA@2x.jpeg" /></figure><p><strong><em>What are Push Notifcations?</em></strong></p><p>“Push notifications is a mechanism for a mobile/web application to convey certain data or messages from one edge to another.”</p><p>Hold on, so technical right. So, just scroll down your notification bar and all that you can see is what is called as push notifications!! Whether it be your zomato offers, dominos treat or your social media popups.</p><p><strong><em>Why am I understanding this?</em></strong></p><p>Today’s blog is just to get a bird’s eye view of how it works to send realtime notifications in just few clicks!</p><p>So, Imagine you have to send a notification from device to device, android to ios, or ios to web,or from one device to multiple devices!! It seems to be a tough job. But it isn’t. Before getting into <strong><em>“How to implement these?”, Let’s talk about which one to use!!</em></strong></p><p>I assume you all have your django setup ready. <a href="https://www.digitalocean.com/community/tutorials/how-to-install-django-and-set-up-a-development-environment-on-ubuntu-16-04">If not, just hurry up and get it installed. And set up your</a> environment (firebase).</p><p><strong><em>TYPES- FCM, PyFcm or txFcm??</em></strong></p><blockquote><strong>FCM- “ </strong>Firebase Cloud Messaging”,a cross-platform messaging solution that lets you reliably send messages at no cost. It provides it’s own model for sending notifications<strong> </strong>(FCMDevice Model )and <strong>overriding</strong> it is a tedious task!</blockquote><blockquote><strong>PyFCM- “</strong>Python client for FCM”. It includes all functionality as fcm and in plus, adding your<strong> custom model</strong> is an easy task here! But, PyFCM is good for synchronous ( blocking ) python.</blockquote><blockquote><strong>txFCM- “</strong>Twisted Python client for FCM”. It includes all functionalities covered in PyFCM and If you have to send high number of concurrent messages then using <a href="http://twistedmatrix.com/">Twisted</a> is a good option and it removes your blocking problem too!</blockquote><p><strong><em>So, done with the theory,Let’s catch you to the implementation!</em></strong></p><p><strong><em>FCMDEVICE Model</em>: Used as it is when using FCM, can be written custom with other 2 types.</strong></p><p><strong>Fields-</strong></p><pre><strong>&lt;&gt;</strong> registration_id (required — is FCM token of a device)<br><strong>&lt;&gt;</strong> name (optional)<br><strong>&lt;&gt;</strong> active (default: true)<br><strong>&lt;&gt; </strong>user (optional)<br><strong>&lt;&gt;</strong> device_id (optional — can be used to uniquely identify devices)<br><strong>&lt;&gt;</strong> type (‘android’, ‘web’, ‘ios’)</pre><p><strong><em>Step1 : Installation:</em></strong></p><pre><strong>&quot;For FCM&quot;  - </strong>pip install fcm-django<br><strong>&quot;For PyFcm&quot;- </strong>pip install pyfcm<br><strong>&quot;For txFcm&quot;- </strong>pip install txfcm</pre><p><strong><em>Step2 : Edit your settings.py:</em></strong></p><pre><strong><em>For FCM:<br>    </em></strong>FCM_DJANGO_SETTINGS = {<br>        &quot;FCM_SERVER_KEY&quot;: &quot;[your api key]&quot;<br>     }<br><strong><em>For others:<br>    </em></strong>FCM_SERVER_KEY=&quot;[your api key]&quot;</pre><pre>#you can get this api key: <a href="https://console.firebase.google.com/project/&lt;project-name&gt;/settings/cloudmessaging">https://console.firebase.google.com/project/&lt;project-name&gt;/settings/cloudmessaging</a></pre><pre><strong>Note</strong>: While using FCM add the following to your installed apps.</pre><pre>     INSTALLED_APPS = (<br>          ...<br>          &quot;fcm_django&quot;<br>      )</pre><p><strong><em>Step3 : Let’s import notification classes from each of the libraries!</em></strong></p><pre><strong>&quot;For FCM&quot;-   from</strong> fcm_django.models <strong>import</strong> FCMDevice<br><strong>&quot;For PyFcm&quot;- from</strong> pyfcm <strong>import</strong> FCMNotification<br><strong>&quot;For txFcm&quot;- from</strong> txfcm <strong>import</strong> TXFCMNotification<br>             <strong>from</strong> twisted.internet <strong>import</strong> reactor<br><strong>from </strong>settings <strong>import </strong>FCM_SERVER_KEY</pre><p><strong><em>Step4 : Almost there, so let’s define our NOTIFICATION FUNCTION</em></strong></p><p>But, before doing that. Keep a look at this- “<strong>send_notification” </strong>function has two parts. First, <strong>Notification</strong> which you can refer for sending the title or the message and the other, <strong>Data message </strong>ehich includes the additional information that you wish to send along with the title that can help you with further pages.</p><blockquote><strong>for example-</strong> You recieved a notification from zomato saying “ your order is out for delivery”(i.e,notification part) and when you tap on that popup, you find the info related to order.(i.e,data part)</blockquote><p>Moving on, let’s define a common send_notification that can be called at different times(<em>“order placed”,”cancelled order”, “out for delivery”,etc</em>) for each type!</p><ol><li><strong><em>FCM</em></strong></li></ol><pre><strong><em>def</em></strong> send_notification(user_ids,title, message, data):<br>   <em>try:</em><br>      device = <strong>FCMDevice</strong>.objects.filter(user__in=user_ids).first()<br>      result = device.send_message(title=title,body=message,<br>                          data=data,sound=True)<br>      return result<br>   <em>except:</em><br>      pass</pre><p><strong><em>2. PyFcm:</em></strong></p><pre><strong><em>def</em></strong> send_notification(user_objects,title, message, data):<br> <em> try:</em><br>    push_service = <strong>FCMNotification</strong>(api_key=FCM_SERVER_KEY)<br>    fcm_token = []<br>    for obj in user_objects:<br>        fcm_token.append(obj.registration_id)<br>    return push_service.notify_multiple_devices(<br>          registration_ids=fcm_token,message_title=title,<br>          message_body=message, data_message=data)<br>  <em>except:</em><br>     pass</pre><p><strong><em>3. txFCM:</em></strong></p><pre><strong><em>def</em></strong> send_notification(user_objects,title, message, data):<br> <em> try:</em><br>    push_service = <strong>TXFCMNotification</strong>(api_key=FCM_SERVER_KEY)<br>    fcm_token = []<br>    for obj in user_objects:<br>        fcm_token.append(obj.registration_id)<br>    return push_service.notify_multiple_devices(<br>          registration_ids=fcm_token,message_title=title,<br>          message_body=message, data_message=data)<br>  <em>except:</em><br>     pass</pre><p><strong><em>Step5 : Let’s call this function and we are done!</em></strong></p><pre>#defining data message (Extra details)<br>data = {<br>         &quot;name&quot;: &quot;HORN OK PLEASE!&quot;,<br>         &quot;days&quot;: 3,<br>         &quot;country&quot;: &quot;United States&quot;<br>       }<br></pre><blockquote>calling function : <em>Here, user_ids to be send in FCM and user objects otherwise. These are id’s of user who will recieve notification</em></blockquote><pre><strong>send_notification(user_ids</strong>=[&quot;1&quot;,&quot;2&quot;,&quot;3&quot;],<br>                  <strong>title</strong>=&quot;It&#39;s now or never: Horn Ok is back!&quot;,<br>                  <strong>message</strong>=&quot;Book now to get 50% off!&quot;,<br>                  <strong>data</strong>=data<strong>)</strong></pre><p><em>Here you go,you got notification! And, we are done!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57e3c22db52b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Surprised by hope!!]]></title>
            <link>https://nancy-khullar97.medium.com/belief-77ed5c107c81?source=rss-dbb35f3d8cc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/77ed5c107c81</guid>
            <category><![CDATA[poet]]></category>
            <category><![CDATA[stay-at-home]]></category>
            <category><![CDATA[poetry]]></category>
            <category><![CDATA[stay-safe]]></category>
            <category><![CDATA[earth]]></category>
            <dc:creator><![CDATA[Nancy Khullar]]></dc:creator>
            <pubDate>Sun, 09 Aug 2020 15:47:28 GMT</pubDate>
            <atom:updated>2020-08-09T15:50:11.851Z</atom:updated>
            <content:encoded><![CDATA[<p>-Nancy Khullar</p><p>What all is happening!!</p><p>Shows,if we are together..</p><p>We can deal with this weakening!</p><p>As the quote suggests..</p><p><strong><em>“United we stand,divided we fall..</em></strong></p><p><strong><em>Stay united people,</em></strong></p><p><strong><em>And let the earth play it’s role..”</em></strong></p><p>Though I agree,</p><p>What we have done so far with our nature?</p><p>We were supposed to pay today or later..</p><p>China has been the one who acted as a resource,</p><p>But deep down we all knew it’s the upper force!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/185/1*2JldqW-wELDrz1L6L7BKBw@2x.jpeg" /></figure><p><em>Because..</em></p><p>A mother remains a mother,</p><p>No matter whether you bother..</p><p>She will treat you the way she used to do,</p><p>She will feed you the way she used to do!</p><p>But yes, take it as a warning,</p><p>And stop this nature-torturing!!</p><p>And keep your hopes positive and high,</p><p>Don’t worry you won’t die..</p><p>Because I know you are following all the rules,</p><p>And this shows you are not a fool😉😉!!</p><p><strong>Stay safe!! Stay home!!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77ed5c107c81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Role of DevOps in Mobile Application Development]]></title>
            <link>https://nancy-khullar97.medium.com/role-of-devops-in-mobile-application-development-202a52c235ff?source=rss-dbb35f3d8cc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/202a52c235ff</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Nancy Khullar]]></dc:creator>
            <pubDate>Sun, 09 Aug 2020 14:42:29 GMT</pubDate>
            <atom:updated>2020-08-09T15:30:44.932Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Role of DevOps in Mobile Application Development</strong></p><p>-Nancy Khullar</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*H_zGCe6v52W0eiGT" /></figure><p><strong>“DevOps</strong> is not a Goal, But a never-ending process of continual improvement” — Jez Humble</p><p>As the quote suggests, the human race has always been revolving around finding solutions. Referencing from the invention of the wheel to sliced bread, we have explored this world enormously with no end in sight.</p><p>Have you ever wondered about the beginning of the internet era?</p><p>From minutes to load and now, seconds to download, the advancement has played its vital role. We have transformed from snail’s speed to lightning speed. The internet, which was rarely accessed by few through desktops, is now widely accepted through smartphones. In fact, CISCO has found that worldwide mobile users are populating 2 times faster than the global population. In order to meet this increasing demand, the enterprises came into action to develop apps that could cover worldwide.</p><p>However, matching the pace to launch applications and make an everlasting impact on the industry, many important features were left behind. Accordingly, the crucial components of versatile application improvement, for example, the application advancement, security, the nature of code, deployment, automation and practicality were left as a second thought.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/0*OEaMxumUw4j8MFuc" /></figure><p>The flood has at last settled down and today application advancement organizations have taken the inside stage. In this evolving scene, it has become imperative to concentrate on the components that were recently ignored and adjust new procedures that give quality arrangements lower costs.</p><p>And, that is where DevOps come into play.</p><p>But, before rushing onto the role that DevOps play in mobile application development. We need to know about “What is DevOps?”</p><h3>What is DevOps?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*ty2FmjkODmrgtG-qbpop4A.png" /></figure><p>DevOps simply comprises two words: Development and Operations.</p><p>Before understanding the problem statement that DevOps is trying to solve, we need to understand what DevOps is not actually. DevOps is not a tool,neither a software nor a programming language that you can learn.</p><p>DevOps is moreover a philosophy, an outlook of working for an association with the goal that new highlights reach to the millions of users as early as possible.It is a way of deploying the product from development phase to the production stage.It is a cutting edge approach that overcomes any barrier between development and operations. It involves better coordinated effort between all the patrons that deal with software. In simpler terms, it guarantees everybody dealing with the venture is in the same spot. So all the departments or teams engaged with software development are associated successfully. It assists speed with increasing the procedure and dispose of pointless expenses.</p><h3>Benefits of DevOps:</h3><p>DevOps has brought the turn of events and tasks to the same spot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/0*qCAsiKU7ZFV20UlM" /></figure><p>Before DevOps, programmers used to develop the whole code and afterward pass it on to the operations team.</p><p>With DevOps process, duties are distributed equally among various teams with a solitary objective that each team has a clear visibility of application performance.</p><p>Implementing DevOps offers:</p><ul><li>Consistent Software Delivery</li><li>Improved Customer Experience</li><li>Quicker Resolution of Bug Fixes/Problems</li><li>Higher Employee Engagement</li><li>Automatic build creation</li><li>Automatic Development without human interaction</li><li>Quicker delivery of the product</li><li>Can proceed with unit testing and run all the test cases present in system automatically</li><li>Progressively stable environment for easy deployments</li><li>Provides test code compatibility on different python version</li><li>More Opportunity for Innovation</li><li>It has helped in reducing some bottlenecks such as :</li><li>Conflicting development process</li><li>Absence of proprietorship</li><li>Manual testing process</li><li>Insecurity in work process</li></ul><h3>What makes DevOps efficient?</h3><p>Implementing DevOps for mobile application development involves executing the six fundamental components that integrate the entire process together and yields the best results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/0*ZTH4owdqd7BMQdwq" /></figure><h3>Continuous Business Planning</h3><p>It refers to joining the ends of various teams working altogether starting from developers, project managers to operations staff and different stakeholders. It helps to get everybody on a similar stage to finalize the scope of application.</p><h3>Continuous Integration</h3><p>Continuous integration, on the other side, guarantees that the code put together by one developer gets along with the code put together by the other developer(s). Basically, DevOps asks for frequent builds which need to be integrated with the latest code.</p><h3>Continuous Testing</h3><p>Testing is a significant piece of the SDLC (Software Development Lifecycle). Testing guarantees that the quality of the product delivered at the end-user must not be hampered in any case. DevOps automatically run the test cases without any human interaction.</p><h3>Continuous Monitoring</h3><p>A mobile app performing well in a test environment might fail in a live environment. The reasons for these failures can be multiple, for example, memory, network, power and so forth. It is important, in this manner, for developers to ensure that consistent observing is done by means of outsider SDKs for log, crash report, etc to discover the root cause of the problem.</p><h3>Continuous release and deployment</h3><p>The continuous release refers to the training that ensures the code is deployed to the production environment by pushing each change to the production environment automatically.</p><p>Continuous deployment is the following stage of continuous release. In constant deployment, each change that has been endorsed by continuous testing gets deployed to the production condition consequently.</p><h3>Continuous user feedback and organization</h3><p>Feedback today is practically quick and can spread to different individuals in a flash. Good feedback can increment both the mindset and the market for your organization, legitimately affecting your corporate image.</p><p>Continuous feedback is fundamental to application release and deployment because it assesses the impact of each release at the user end and afterwards makes an evaluation report and give it to the DevOps team to improve the future releases.</p><h3>Conclusion</h3><p>In a nutshell, there is nothing of the sort as a separate DevOps for mobile application improvement. DevOps is a general methodology that works for all segments as well as various types of application improvement.</p><p>Though there are certain difficulties involved in implementing DevOps for mobile applications. But, there are also additional advantages that make the whole journey worth it.</p><h3>Reference Links:</h3><p><a href="https://devops.com/role-of-devops-in-mobile-app-development/">https://devops.com/</a></p><p><a href="https://appinventiv.com/blog/devops-for-mobile-app-development/">https://appinventiv.com/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=202a52c235ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>