Skip to content

Commit

Permalink
Merge pull request #134 from mapillary/fix-auth-for-tiles-endpoints
Browse files Browse the repository at this point in the history
Fix 403 auth error for tiles endpoints
  • Loading branch information
Rubix982 authored Nov 29, 2021
2 parents 16845e6 + 3de4096 commit cc99989
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/mapillary/models/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _initiate_request(self, url: str, method: str, params: dict = None):

return res

def get(self, url: str = None, params: dict = None):
def get(self, url: str = None, params: dict = {}):
"""
Make GET requests to both mapillary main endpoints
Expand All @@ -191,8 +191,12 @@ def get(self, url: str = None, params: dict = None):
if url is None:
logger.error("You need to specify an endpoint!")
return

self.session.headers.update({"Authorization": f"OAuth {self.__access_token}"})

# Determine Authentication method based on the requested endpoint
if "https://graph.mapillary.com" in url:
self.session.headers.update({"Authorization": f"OAuth {self.__access_token}"})
else:
params['access_token'] = params.get('access_token', self.__access_token)

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

Expand Down

0 comments on commit cc99989

Please sign in to comment.