Skip to content

Commit

Permalink
Merge pull request #28 from interline-io/valhalla-tilepack-download-p…
Browse files Browse the repository at this point in the history
…ython3

`valhalla_tilepack_download` should also work in Python3
  • Loading branch information
irees authored Mar 13, 2019
2 parents 3a31423 + eb68121 commit 1e95984
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions planetutils/tilepack_downloader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import absolute_import, unicode_literals, print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.parse import urlparse, urlencode, urlsplit, urlunsplit, parse_qs
from urllib.request import urlopen

import os
Expand All @@ -19,15 +19,15 @@ def download(self, outpath, version='latest', api_token=None, compressed=False):
if version == 'latest':
url = '%s/valhalla_planet_tilepacks/download_latest'%(self.HOST)
# Make url
u = list(urlparse.urlsplit(url))
q = urlparse.parse_qs(u[3])
u = list(urlsplit(url))
q = parse_qs(u[3])
if api_token:
q['api_token'] = api_token
u[3] = urlencode(q)
url = urlparse.urlunsplit(u)
url = urlunsplit(u)
# Download
download.download_curl(url, outpath, compressed=compressed)

def list(self):
url = "%s/valhalla_planet_tilepacks.json"%(self.HOST)
contents = urlopen(url).read()
Expand Down Expand Up @@ -60,4 +60,4 @@ def list(self):
a['valhalla_version'],
a['interline_planetutils_version'],
a['interline_valhalla_tile_cutter_version']
))
))

0 comments on commit 1e95984

Please sign in to comment.