Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Commit 029a509

Browse files
author
Chris Brown
committed
Use API token for export requests
Project should not have to be shared in order to export
1 parent 367bbdb commit 029a509

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

rasterfoundry/models/project.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,10 @@ def get_export(self, bbox, zoom=10, export_format='png'):
9393
scheme=self.api.scheme, host=self.api.tile_host,
9494
export_path=export_path
9595
)
96-
map_token = self.get_map_token()
97-
if not map_token:
98-
raise "Project {} has not yet been shared".format(self.id)
9996

10097
return requests.get(
10198
request_path,
102-
params={'bbox': bbox, 'zoom': zoom, 'mapToken': map_token.token},
99+
params={'bbox': bbox, 'zoom': zoom, 'token': self.api.api_token},
103100
headers=headers
104101
)
105102

@@ -137,11 +134,10 @@ def tms(self):
137134
"""Return a TMS URL for a project"""
138135

139136
tile_path = self.TILE_PATH_TEMPLATE.format(id=self.id)
140-
path = '{scheme}://{host}{tile_path}'.format(
137+
return '{scheme}://{host}{tile_path}?token={token}'.format(
141138
scheme=self.api.scheme, host=self.api.tile_host,
142-
tile_path=tile_path
139+
tile_path=tile_path, token=self.api.api_token
143140
)
144-
return path + '?token={}'.format(self.api.api_token)
145141

146142
@check_notebook
147143
def add_to(self, leaflet_map):

0 commit comments

Comments
 (0)