Hack Day at flipkart

flipkart is a one of the best e-commerce company in India that let’s gives their user a amazing online shopping experience.

But i feel  really sad for people who cannot enjoy online shopping just because of the fact that they don’t have computers,  don’t know how to use computers or don’t have internet connection which is very common in india.

Also people having access to cell  phone is very common in India. So my hack was directed to mobile domain. I had some previous experience with SMS apps so i thought and build something that let’s people search items on flipkart using sms.

Me at flipkart hack day

Here is what i finally came up with

Continue reading

Google Url shortener in google app engine

This is my first post so here is something pretty simple

Python snippet to use Google URL shortener  API

so for url https://bipuljain.wordpress.com get a shortened url as in goo.gl/ABCDE

To use google url shortener API, you need either a API KEY or you need to use a oauth model.

Preferring API Key approach

from django.utils import simplejson as json
from google.appengine.api import urlfetch

G_API_KEY='1234567890987654321'
g_api_base='https://www.googleapis.com/urlshortener/v1/url?key='+G_API_KEY
def shorten(long_url):
   try:
#long_url is Long url to be shortened   and converting it into json format
      values = json.dumps({'longUrl' : long_url})
      headers = {'Content-Type' : 'application/json'}  #setting header type to json
      result = urlfetch.fetch(g_api_base,payload=values, method='POST', headers=headers)   #Sending the request
      output=json.loads(result.content)   #Converting in json response into a python dictionary 
      short_url=output["id"].replace("http://","")  #Further removing http:// from url 
      return short_url
   except:
      pass #Do something here

here g_api_base is a url to which you are supposed to send a POST request with your URL in json encode format along with the API_KEY as a query parameter.

Thankyou,
Hope you like it