Giter VIP home page Giter VIP logo

uberfare's Introduction

Uberfare

https://travis-ci.org/BurnzZ/uberfare.svg?branch=master

This is a simple wrapper to the official Uber Python SDK intended to collect data from a given origin and destination at a specified time interval.

The current implementation only handles the price estimate feature since it doesn’t need OAuth 2.0 access.

Motivation

I’m using this tool in order to gather data and then evaluate when’s the best time to leave the house and book an Uber ride to work, and vice-versa.

Requirements

  • Python 3.4+

Installation

I'd recommend installing it via pipenv:

$ pipenv install uberfare
$ # or via the usual pip
$ pip3 install uberfare

API Key

Get your Server Token API Key by creating an app at: developer.uber.com/dashboard, and then:

  • Create or Select an app
  • Copy the Server Token value in the Auth page

Before using this package, export your Server Token as: export UBER_SERVER_TOKEN=<Server Token>. You can however, override this when using the CLI (see below).

Usage

You have to determine the (latitude,longitude) of your location, since the types of rides available will depend on it.

The best way to get the coordinates is going to maps.google.com and then clicking any point in the map. A small box will then appear at the bottom-center of your screen containing the Longitude and Latitude. Take note of the coordinates for both your origin and destination:

Google Maps Coordinates Lookup

CLI

>>> # To get the fare estimate, provide the arguments: <origin>, <destination>
>>> # (Where origin and destination are in the <LATITUDE,LONGITUDE> format)
>>> uberfare estimate 14.55,121.05 14.52,121.01

>>> # To save all the RAW data in a CSV file, you can do:
>>> uberfare estimate 14.55,121.05 14.52,121.01 --output-file output.csv
CLI demo
>>> # You can also periodically fetch the Uber fares by using the
>>> # --check-interval <time in seconds> flag (short -ci):
>>> uberfare --check-interval 120 estimate 14.55,121.05 14.52,121.01
>>> uberfare -ci 120 estimate 14.55,121.05 14.52,121.01

>>> # To safely save the data in long periods of time, do:
>>> uberfare --check-interval 120 estimate 14.55,121.05 14.52,121.01 --output-file output.csv

>>> # You can override the '$UBER_SERVER_TOKEN' env variable right in the CLI via:
>>> uberfare --server_token <SERVER API KEY> estimate 14.55,121.05 14.52,121.01
>>> uberfare -st <SERVER API KEY> estimate 14.55,121.05 14.52,121.01

Notes

Be careful when specifying a very short time interval for checking the price since you might be rate limited.

Future Releases

  • Better interface for importing as a package
  • Option to use address instead of coordinates (use Google Maps Geocoding API)
  • Support the Upfront Fare data collection by enabling the OAUTH2.

uberfare's People

Contributors

burnzz avatar gustavorps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

uberfare's Issues

Server returns not a number

I haven't gone into it too far, but regex from #5 seems valid.
Nevertheless:

uberfare estimate origin=-36.841934,-73.079622 dest=-36.830313,-73.042668
Usage: uberfare estimate [OPTIONS] <origin> <dest>

Error: Invalid value for "<origin>": Coordinates must be in the format: 123.23,42.1 <LATITUDE,LONGITUDE>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.