├── requirements.txt ├── media └── demo1.png ├── templates ├── uberlogin.html └── results.html ├── README.md ├── LICENSE ├── static └── ridestats.css └── app.py /requirements.txt: -------------------------------------------------------------------------------- 1 | uber_rides 2 | flask -------------------------------------------------------------------------------- /media/demo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surbhioberoi/ridestats/HEAD/media/demo1.png -------------------------------------------------------------------------------- /templates/uberlogin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 |
9 | Login with Uber 10 |


11 |

12 | Login with your Uber account to view cool stats! 13 |

14 |
15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ridestats 2 | 3 | > A web app for cool stats about your Uber rides 4 | 5 | ![demo](media/demo1.png) 6 | 7 | ## Try it 8 | 9 | http://ridestats.surbhioberoi.com 10 | 11 | ## Displayed Information 12 | 13 | * Name of the account holder. 14 | * Number of cities where Uber was used. 15 | * Number of rides taken and in different product types. 16 | * Kilometers travelled in Uber. 17 | * Total time spent waiting for an Uber. 18 | * Total time spent in an Uber. 19 | 20 | You can use this app and check your own cool stats, results can also be shared on facebook. 21 | 22 | I have blogged about creating this app at 23 | http://surbhioberoi.com/a-literature-geek-learns-to-code/ 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Surbhi Oberoi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /static/ridestats.css: -------------------------------------------------------------------------------- 1 | /* Taken from http://purecss.io/combo/1.18.13?/css/layouts/marketing.css */ 2 | 3 | .splash-container { 4 | background: #222222; 5 | z-index: 1; 6 | /* The following styles are required for the "scroll-over" effect */ 7 | width: 100%; 8 | height: 100%; 9 | } 10 | 11 | .splash { 12 | /* absolute center .splash within .splash-container */ 13 | width: 80%; 14 | height: 50%; 15 | margin: auto; 16 | position: absolute; 17 | top: 100px; left: 0; bottom: 0; right: 0; 18 | text-align: center; 19 | text-transform: uppercase; 20 | } 21 | 22 | .resultarea { 23 | width: 80%; 24 | margin: auto; 25 | text-align: center; 26 | } 27 | 28 | /* This is the main heading that appears on the blue section */ 29 | .splash-head { 30 | font-size: 20px; 31 | font-weight: bold; 32 | color: white; 33 | padding: 1em 1.6em; 34 | font-weight: 100; 35 | border-radius: 5px; 36 | } 37 | 38 | /* This is the subheading that appears on the blue section */ 39 | .splash-subhead { 40 | color: white; 41 | letter-spacing: 0.05em; 42 | opacity: 0.8; 43 | } 44 | 45 | 46 | a { 47 | text-decoration: none; 48 | } 49 | 50 | #map { 51 | height: 80%; 52 | width: 400px; 53 | } 54 | 55 | 56 | 57 | .orangebox { 58 | background-color: #EF6536; 59 | } 60 | 61 | .yellowbox { 62 | background-color: #FFA72B; 63 | } 64 | 65 | .purplebox { 66 | background-color: #8156A6; 67 | } 68 | 69 | .greenbox { 70 | background-color: #59B560; 71 | } 72 | 73 | .redbox { 74 | background-color: #E04F4A; 75 | } 76 | 77 | 78 | .bluebox { 79 | background-color: #008FD5; 80 | } 81 | 82 | 83 | .greybox { 84 | background-color: #7A8388; 85 | } 86 | 87 | .dyellowbox { 88 | background-color: #FF9702; 89 | } 90 | 91 | .bigstat { 92 | font-size: 3em; 93 | font-weight: bold; 94 | margin: 30px; 95 | } 96 | 97 | .loginbutton { 98 | border: solid 2px white; 99 | } 100 | 101 | .bold { 102 | font-weight: bold; 103 | } 104 | 105 | .name { 106 | font-size: 2em; 107 | } -------------------------------------------------------------------------------- /templates/results.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |
11 | 12 | 13 |
14 |
15 |

{{firstname}} {{lastname}}

16 |
17 |
18 |

19 | {% for key, value in products.iteritems() %} 20 | {{ key }}: {{ value }}
21 | {% endfor %} 22 |

23 |
24 |
25 | 26 | 27 |
28 |
29 |

{{ride_count}}
rides.

30 |
31 |
32 |

{{cities_count}} 33 |
34 | {% if cities_count < 2 %} 35 | city. 36 | {% else %} 37 | cities. 38 | {% endif %}

39 |
40 |
41 |

Travelled
{{total_distance}}
kms.

42 |
43 |
44 | 45 | 46 |
47 |
48 |

{{waittime}}
hours waiting

49 |
50 |
51 |

{{trip_time}} 52 |
hours in Uber

53 |
54 |
55 | 56 |
57 |
58 |

Share on Facebook

59 |
60 |
61 | 62 | 63 |
64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | import base64 2 | from flask import Flask, request, redirect, render_template 3 | from uber_rides.auth import AuthorizationCodeGrant 4 | from uber_rides.client import UberRidesClient 5 | import json 6 | from collections import defaultdict 7 | 8 | CLIENT_ID = "") 98 | def shareurl(hashed): 99 | data = base64.b64decode(hashed).split('|') 100 | products_start = data.index("PS") + 1 101 | products_end = data.index("PE") 102 | uber_products = {} 103 | for i in range(products_start, products_end-1, 2): 104 | uber_products[data[i]] = data[i+1] 105 | 106 | return render_template('results.html', 107 | ride_count=int(data[products_end+1]), 108 | cities_count=int(data[products_end+2]), 109 | firstname=data[0], 110 | lastname=data[1], 111 | products=uber_products, 112 | total_distance=float_format(float(data[products_end+3])*1.60934), 113 | waittime=float_format(float(data[products_end+4])), 114 | trip_time=float_format(float(data[products_end+5])), 115 | fblink="https://ridestats.surbhioberoi.com" + request.path) 116 | 117 | 118 | 119 | if __name__ == "__main__": 120 | app.run(host='0.0.0.0', port=4000, debug=True) 121 | 122 | --------------------------------------------------------------------------------