uber busit
In [ ]:
uber busit script
In [29]:
import requests
import getpass
import json
from IPython.display import Image
In [ ]:
In [3]:
myusr = getpass.getuser()
In [8]:
with open('/home/{}/mapquest.txt'.format(myusr), 'r') as mapkey:
thekey = (mapkey.read())
In [10]:
thekey
Out[10]:
In [11]:
fixkey = thekey.replace('\n', '')
In [12]:
fixkey
Out[12]:
In [20]:
with open('/home/{}/uberhisfix.json'.format(myusr), 'r') as uberhistory:
hisjs = json.loads(uberhistory.read())
In [26]:
hislat = hisjs['history']['start_city']['latitude']
In [27]:
hislon = hisjs['history']['start_city']['longitude']
In [32]:
ubimg = requests.get('http://www.mapquestapi.com/staticmap/v4/getmap?key=' + fixkey + '&size=400,200&zoom=10¢er=' + str(hislat) + ',' + str(hislon), stream=True)
In [35]:
r = ubimg.url
In [38]:
with open(ubimg.url, 'wb') as f:
r.raw.decode_content = True
shutil.copyfileobj(r.raw, f)
In [ ]:
Image(filename='output1.png')
Comments
Comments powered by Disqus