#!/usr/bin/env python # coding: utf-8 # # Ipyrest, HERE Examples # # These examples require two tokens, an `API_ID` and `APP_CODE`, which are assumed to be stored as environment variables named `HEREMAPS_APP_ID` and `HEREMAPS_APP_CODE`, respectively. There are available after a free registration on https://developer.here.com. API documentation can be found here: https://developer.here.com/documentation. # # More to comeā€¦ # In[ ]: import os import urllib # ## JSON Examples # In[ ]: from ipyrest import Api Api(url='https://account.api.here.com/version') # In[ ]: url = 'https://geocoder.api.here.com/6.2/geocode.json' params = dict( searchtext=urllib.parse.quote('Invalidenstr. 116, 10115 Berlin, Germany'), app_id=os.getenv('HEREMAPS_APP_ID'), app_code=os.getenv('HEREMAPS_APP_CODE') ) Api(url, params=params) # ## Bitmap Example # In[ ]: url = 'https://1.{maptype}.maps.api.here.com/' \ 'maptile/2.1/{tiletype}/newest/{scheme}/{zoom}/{xtile}/{ytile}/{size}/{format}' args = dict( maptype='base', tiletype='maptile', scheme='normal.night', zoom='11', xtile='525', ytile='761', size='256', format='png8', ) params = dict( app_id=os.getenv('HEREMAPS_APP_ID'), app_code=os.getenv('HEREMAPS_APP_CODE'), ppi='320', ) Api(url, args=args, params=params)