Jump to content

Get estimated Uber pick up times


Recommended Posts

Download: https://github.com/fspinillo/alfred-uber/blob/master/workflow/UberTime.alfredworkflow?raw=true

 

With the release of Uber's new public API, I wanted to build a workflow to check on the estimated pick up times based on criteria given. The workflow was built in Python 2.7, and is bundled with requests and Dean Jackson (deanishe) wonderful Workflow package.

 

What the workflow does

  • Stores your Uber server token in Apple's filevault
  • Stores your home and work address
  • Enter zipcode, address or city with country to get estimated times
  • Get estimated times for your work address
  • Get estimated times for your home address

 

Setup

  1. Go to the Uber developer page and register an app
  2. Once registered, you'll have a server token.
  3. Launch Alfred, type in 'utoken', paste your token and hit enter. A notfication should pop up notifying you it was saved

optional

  • Set your home address by launching Alfred and entering 'usethome'
  • Set your home address by launching Alfred and entering 'usetwork'

 

Using the workflow

 

Important: Addresses must be entered with the country.

Example: Rome, Italy // San Francisco, CA // Paris, France

 

If you just want to search based on any address, launch Alfred and enter 'utime' with the criteria.

 

vwH6Aio.png?1

 

If you want to search for times based on your home address, launch Alfred and enter 'uhome'

 

XrUBaZN.png?1

 

If you want to search for times based on your home address, launch Alfred and enter 'work'

 

cLQfU1X.png?1

Edited by frankspin
Link to comment

Sounds great. Thx for sharing.

Unfortunately I get this..

 

Bildschirmfoto%202014-08-23%20um%2023.45

 

Of course I paste the token.

 

Maybe it's because I use Uber in germany?

 

Thanks again.

 

 

This should work in Germany, I justed it out on my end.

 

As for the error, I forgot to import a module. I just uploaded the fix to the github repo. Also make sure you run 'usethome'/'usetwork' if you're going to be using 'uhome' and 'uwork' so it can save your address.

Link to comment

Thx frankspin.

Unfortunately any address I use, I get the still the same error. 

 

Can you use the debug window when running it? Is it just for when you use uhome or does it work with utime?

 

Only thing I can think of is region is causing an issue. I can poke around for Germany specific API url's and see if that fixes it.

Edited by frankspin
Link to comment

Here we go. No difference using uhome uwork or utime.

Starting debug for 'UberTime'

[ERROR: alfred.workflow.input.scriptfilter] Code 1: 16:19:16 workflow.py:1256 ERROR    'times'
Traceback (most recent call last):
  File "/Users/Daniel/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.D7370CAE-1E41-41A7-956F-00BD4E747929/workflow/workflow.py", line 1254, in run
    func(self)
  File "uhome.py", line 51, in main
    uberArray = uberData['times']
KeyError: 'times'
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 16:19:31 workflow.py:1256 ERROR    'times'
Traceback (most recent call last):
  File "/Users/Daniel/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.D7370CAE-1E41-41A7-956F-00BD4E747929/workflow/workflow.py", line 1254, in run
    func(self)
  File "uwork.py", line 52, in main
    uberArray = uberData['times']
KeyError: 'times'
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 16:19:50 workflow.py:1256 ERROR    'times'
Traceback (most recent call last):
  File "/Users/Daniel/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.D7370CAE-1E41-41A7-956F-00BD4E747929/workflow/workflow.py", line 1254, in run
    func(self)
  File "uhome.py", line 51, in main
    uberArray = uberData['times']
KeyError: 'times'

[ERROR: alfred.workflow.input.scriptfilter] Code 1: 16:21:47 workflow.py:1256 ERROR    'times'
Traceback (most recent call last):
  File "/Users/Daniel/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.D7370CAE-1E41-41A7-956F-00BD4E747929/workflow/workflow.py", line 1254, in run
    func(self)
  File "uber.py", line 40, in main
    uberArray = uberData['times']
KeyError: 'times'
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 16:21:48 workflow.py:1256 ERROR    'times'
Traceback (most recent call last):
  File "/Users/Daniel/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.D7370CAE-1E41-41A7-956F-00BD4E747929/workflow/workflow.py", line 1254, in run
    func(self)
  File "uber.py", line 40, in main
    uberArray = uberData['times']
KeyError: 'times'
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 16:21:51 workflow.py:1256 ERROR    'times'
Traceback (most recent call last):
  File "/Users/Daniel/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.D7370CAE-1E41-41A7-956F-00BD4E747929/workflow/workflow.py", line 1254, in run
    func(self)
  File "uber.py", line 40, in main
    uberArray = uberData['times']
KeyError: 'times'
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 16:21:52 workflow.py:1256 ERROR    'times'
Traceback (most recent call last):
  File "/Users/Daniel/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.D7370CAE-1E41-41A7-956F-00BD4E747929/workflow/workflow.py", line 1254, in run
    func(self)
  File "uber.py", line 40, in main
    uberArray = uberData['times']
KeyError: 'times'
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 16:21:53 workflow.py:1256 ERROR    'times'
Traceback (most recent call last):
  File "/Users/Daniel/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.D7370CAE-1E41-41A7-956F-00BD4E747929/workflow/workflow.py", line 1254, in run
    func(self)
  File "uber.py", line 40, in main
    uberArray = uberData['times']
KeyError: 'times'
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 16:21:55 workflow.py:1256 ERROR    'times'
Traceback (most recent call last):
  File "/Users/Daniel/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.D7370CAE-1E41-41A7-956F-00BD4E747929/workflow/workflow.py", line 1254, in run
    func(self)
  File "uber.py", line 40, in main
    uberArray = uberData['times']
KeyError: 'times'
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 16:21:55 workflow.py:1256 ERROR    list index out of range
Traceback (most recent call last):
  File "/Users/Daniel/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.D7370CAE-1E41-41A7-956F-00BD4E747929/workflow/workflow.py", line 1254, in run
    func(self)
  File "uber.py", line 28, in main
    lat = mapsData['results'][0]['geometry']['location']['lat']
IndexError: list index out of range
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 16:21:57 workflow.py:1256 ERROR    'times'
Traceback (most recent call last):
  File "/Users/Daniel/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.D7370CAE-1E41-41A7-956F-00BD4E747929/workflow/workflow.py", line 1254, in run
    func(self)
  File "uber.py", line 40, in main
    uberArray = uberData['times']
KeyError: 'times'
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 16:21:58 workflow.py:1256 ERROR    'times'
Traceback (most recent call last):
  File "/Users/Daniel/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.D7370CAE-1E41-41A7-956F-00BD4E747929/workflow/workflow.py", line 1254, in run
    func(self)
  File "uber.py", line 40, in main
    uberArray = uberData['times']
KeyError: 'times'
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 16:21:59 workflow.py:1256 ERROR    'times'
Traceback (most recent call last):
  File "/Users/Daniel/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.D7370CAE-1E41-41A7-956F-00BD4E747929/workflow/workflow.py", line 1254, in run
    func(self)
  File "uber.py", line 40, in main
    uberArray = uberData['times']
KeyError: 'times'
Link to comment

It's not getting the latitude from Google Maps, which is why it's not able to build the array for Uber. What's interesting to me is I can use this just fine with the address you provided but it's not working your location.

 

I've never really played with localization before and I don't have a VPN, but I'll see if I can get my region changed to test this out for your region.

 

Thanks for your patience!

Link to comment

Quick edit:

 

I logged into a sever based in the Netherlands and sucessfully ran this without an issue via terminal. So I'm not entirely sure what is going on, trying to get other people to test this out for me to see.

 

Additionally I noticed requests is not being called properly despite being where it needs to be. Looking into that too.

 

Feedback from someone else and they're getting the same error as you, so it's something with it working on different machines

Edited by frankspin
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...