/ Programming

Project 1: When a literature geek learns to code

First, The link to try the app - https://ridestats.surbhioberoi.com

And the code https://github.com/surbhioberoi/ridestats

Few months ago, I could have never imagined myself as a programmer. I studied English Literature for last five years but after getting inspired by a friend, I gave learning to code a thought. There is one thing particularly common between writing and coding, i.e creating things! It just feels amazing when you complete your work and share it with people to read/use. There is so much to learn! I discovered Python was not only a snake, you can learn almost anything for free using the internet and programming is fun. It sure was not very interesting in the beginning when I took up the Python course on Codeacademy but as I moved on to create a small project by myself, I realised that it was so interesting. After completing the basic Python course, I started the Udacity course for HTML and CSS. I started figuring out how websites were created, which till now I only could use and that felt awesome!

I am midway through the Udacity HTML/CSS course but I started working on this project. I discussed project ideas I could undertake at this moment with a programmer friend and zeroed on this Uber statistics app as my first coding project.

I figured that to create this app I needed users to login to their Uber account, similar to how some websites allow us to use Facebook/Google login. I googled about it and found this thing called "API". I started with wikipedia pages and a small video by Google on Youtube explaining what APIs was. I then searched about Uber's API and found their developers website. I started with reading the documentation and registering an app so that I could obtain an API key. After getting the key I found that Uber already had a Python SDK (a readymade Python package that wraps their API) that I could use in my app. To become familiar with the classes and methods exposed in their python SDK, I opened the Python interpreter on my terminal and using the API key, tried some of their API endpoints (URLs where you make a request with some parameters for data). I tried to find about the products in my area and current surge prices. Next, I tried the history API on my terminal and created a function there itself.

I now had the task of creating a web app. I searched about how to do that with Python and after some some searching, landed on Flask. Flask seemed real simple from their homepage and I was hooked. I started reading the Flask quickstart and doing the stuff in a text file opened in Sublime Text. I could create a functional but ugly app. Next, I used CSS to make it look presentable and separated the HTML written in the python code to different HTML templates in a separate directory.

Later I wanted everyone to share their results on Facebook but I figured to do that I would have to store the data somewhere which I did not know how to do. So, I decided to pass the result data in the result URL itself! I asked my friend and he suggested an encoding technique called base64. This might not be the best or even a secure way to do it, as anyone can change their result and share it. But hey, this is my first project!

I intend to create much more fun and useful stuff and a writeup on how I created them :)