-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
49 lines (40 loc) · 1.36 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from uber_rides.session import Session
from uber_rides.client import UberRidesClient
import config as cfg
#Set API keys from configuration file
server_token = cfg.server_token
session = Session(server_token=server_token)
# California Academy of Sciences
START_LAT = 37.770
START_LNG = -122.466
# Pier 39
END_LAT = 37.791
END_LNG = -122.405
client = UberRidesClient(session)
response = client.get_products(37.77, -122.41)
products = response.json.get('products')
product_id = products[0].get('product_id')
print "products"
print products
print ""
print "products[0]"
print products[0]
print products[0]["display_name"]
print len(products)
print products[len(products)-1]
#print "product_id:"
#print product_id
#oauth2credential = OAuth2Credential(
# client_id=credentials.get('client_id'),
# access_token=credentials.get('access_token'),
# expires_in_seconds=credentials.get('expires_in_seconds'),
# scopes=credentials.get('scopes'),
# grant_type=credentials.get('grant_type'),
# redirect_url=credentials.get('redirect_url'),
# client_secret=credentials.get('client_secret'),
# refresh_token=credentials.get('refresh_token'),
# )
#session = Session(oauth2credential=oauth2credential)
#return UberRidesClient(session, sandbox_mode=True)
#estimate = api_client.estimate_ride(product_id,37.77,-122.41,37.73,-122.41)
#print estimate