{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Ipyrest, HERE Examples\n", "\n", "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.\n", "\n", "More to comeā¦" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "import urllib" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## JSON Examples" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from ipyrest import Api\n", "Api(url='https://account.api.here.com/version')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "url = 'https://geocoder.api.here.com/6.2/geocode.json'\n", "params = dict(\n", " searchtext=urllib.parse.quote('Invalidenstr. 116, 10115 Berlin, Germany'),\n", " app_id=os.getenv('HEREMAPS_APP_ID'), \n", " app_code=os.getenv('HEREMAPS_APP_CODE')\n", ")\n", "Api(url, params=params)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Bitmap Example" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "url = 'https://1.{maptype}.maps.api.here.com/' \\\n", " 'maptile/2.1/{tiletype}/newest/{scheme}/{zoom}/{xtile}/{ytile}/{size}/{format}'\n", "args = dict(\n", " maptype='base',\n", " tiletype='maptile',\n", " scheme='normal.night',\n", " zoom='11',\n", " xtile='525',\n", " ytile='761',\n", " size='256',\n", " format='png8',\n", ")\n", "params = dict(\n", " app_id=os.getenv('HEREMAPS_APP_ID'), \n", " app_code=os.getenv('HEREMAPS_APP_CODE'),\n", " ppi='320',\n", ")\n", "Api(url, args=args, params=params)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.3" }, "toc": { "nav_menu": {}, "number_sections": false, "sideBar": true, "skip_h1_title": true, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": true } }, "nbformat": 4, "nbformat_minor": 2 }