Network Carrier: T-Mobile Expenses | Python, Visual Studio Code

Mohit Shukla
3 min readSep 8, 2020

--

Code: On GitHub in a Private repository, please contact me on LinkedIn to learn more about this project.

Situation:

When I came to the US in 2019, the first thing everyone does that I did was: Getting a mobile internet plan. After exploring various plans, I finally decided to settle upon the T-mobile family plan. Now, what is a T-Mobile sim based family plan? (T-Mobile’s Essentials family unlimited plan is a great way to get unlimited access to T-Mobile’s solid network and service — for not a lot of money. The plan costs $60 for the first line, $30 for the second, and $15/line for lines 3–6 (a seriously sweet T-Mobile plan price).

Task:

Each family plan has a family head who will pay the total bill of all the family members every month. Guess who was the family head of my 5 friends who opted for the T-mobile plan with me? Yep, that was me.

Every month I had to divide every bill with each member, had to send them a Venmo request via email or app to pay their mobile bill.

Hence, I came up with the idea to automate every step of this process using Python.

Action & Result:

  1. credentials.json — Contains details about gmail api. This is generated when you configure gmail api usage under you google developers profile. This file is later used by the email library provided by gmail to generate a token.pickle file that is later used for future reference. To simplify, this file is needed for the first run, and becomes useless once a pickle file is created.
  2. input.json — Contains input variables that are passed to main.py.
    Following is the format:
    {
    “path”: <complete path to the pdf file>,
    “email”: <Setting to True will implement email feature, else set to False>,
    “sender”: <Email address of the sender/user running this application>
    “venmo”: <Setting to True will implement email feature, else set to False>,
    “user”: <Name of the sender/user who will send the venmo request>
    “test”: <Setting to True will execute application in test mode,else set to False>
    }
  3. token.pickle — File that is generated after the first usage of gmail api. This is used at later stages when sending out the email. Deleting this file will reinitiate the setup process of gmail api.
  4. users.json — Contains user details (name, email) associated to the phone numbers in the account. Following is the format:
    {
    “1234567890”: {
    “name”: “Chandler”,
    “email”: “chandler123@gmail.com
    },
    “1234567345”: {
    “name”: “Monica”,
    “email”: “monica234@gmail.com
    }
    }
  5. venmo.json — Contains token and user details (venmo_user_name, additional amount, additional_note) associated to the phone numbers in the account.
    Following is the format:
    {
    “token”: <Venmo token generated by the user/sender at first use of venmo api.>,
    “users”:{
    “1234567890”: {
    “venmo_user_name”: “chandler_123”,
    “additional_amount”: 0,
    “additonal_note”: “Includes taxes”
    },
    “1234567345”: {
    “venmo_user_name”: “monica_234”,
    “additional_amount”: 10,
    “additonal_note”: “”
    },
    }
    }

Conclusion:

· Constructed a python application to calculate the monthly expenses of mobile carrier service

· Integrated Gmail API service to send an automated email to users reducing the overall manual work to 80%

· Build Up several cases using Pytest module, Integrated Venmo API to send transaction requests to 10+ users

--

--

Mohit Shukla
Mohit Shukla

No responses yet