Skip to content

Commit cc99989

Browse files
authored
Merge pull request #134 from mapillary/fix-auth-for-tiles-endpoints
Fix 403 auth error for tiles endpoints
2 parents 16845e6 + 3de4096 commit cc99989

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/mapillary/models/client.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def _initiate_request(self, url: str, method: str, params: dict = None):
177177

178178
return res
179179

180-
def get(self, url: str = None, params: dict = None):
180+
def get(self, url: str = None, params: dict = {}):
181181
"""
182182
Make GET requests to both mapillary main endpoints
183183
@@ -191,8 +191,12 @@ def get(self, url: str = None, params: dict = None):
191191
if url is None:
192192
logger.error("You need to specify an endpoint!")
193193
return
194-
195-
self.session.headers.update({"Authorization": f"OAuth {self.__access_token}"})
194+
195+
# Determine Authentication method based on the requested endpoint
196+
if "https://graph.mapillary.com" in url:
197+
self.session.headers.update({"Authorization": f"OAuth {self.__access_token}"})
198+
else:
199+
params['access_token'] = params.get('access_token', self.__access_token)
196200

197201
return self._initiate_request(url=url, method="GET", params=params)
198202

0 commit comments

Comments
 (0)