Skip to content

Commit 757c733

Browse files
committed
change how tokens are read
1 parent 5401956 commit 757c733

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

label_maker/utils.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# pylint: disable=unused-argument
22
"""Provide utility functions"""
3+
import os
34
from os import path as op
45
from urllib.parse import urlparse, parse_qs
56

@@ -69,7 +70,10 @@ def download_tile_tms(tile, imagery, folder, kwargs):
6970
width=new_dim, count=3, dtype=rasterio.uint8) as w:
7071
for num, t in enumerate(child_tiles):
7172
t = [str(t[0]), str(t[1]), str(t[2])]
72-
r = requests.get(url(t, imagery),
73+
token = os.environ.get("IMAGE_TOKEN")
74+
fullUrl = imagery + token
75+
print(fullUrl)
76+
r = requests.get(url(t, fullUrl),
7377
auth=kwargs.get('http_auth'))
7478
img = np.array(Image.open(io.BytesIO(r.content)), dtype=np.uint8)
7579
try:

test/fixtures/integration/config_overzoom.integration.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{ "name": "Parking", "filter": ["==", "amenity", "parking"] },
1515
{ "name": "Roads", "filter": ["has", "highway"] }
1616
],
17-
"imagery": os.environ.get('IMAGE_TOKEN'),
17+
"imagery": "https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.jpg?access_token=",
1818
"background_ratio": 1,
1919
"ml_type": "classification",
2020
"seed": 19,

0 commit comments

Comments
 (0)