Skip to content

Commit

Permalink
Merge pull request #308 from letitbevi/update_arcgis
Browse files Browse the repository at this point in the history
Update arcgis - added method _catch_errors
  • Loading branch information
DenisCarriere committed Oct 24, 2017
2 parents 46e99a2 + 206dbf4 commit 082d69f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions geocoder/arcgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ def _build_params(self, location, provider_key, **kwargs):
def _adapt_results(self, json_response):
return json_response['locations']

def _catch_errors(self, json_response):
status = json_response.get('error')
if status:
self.error = status.get('code')
self.message = status.get('message')
self.details = status.get('details')

return self.error


if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
Expand Down
2 changes: 1 addition & 1 deletion geocoder/baidu.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def _adapt_results(self, json_response):

def _catch_errors(self, json_response):
status_code = json_response.get('status')
if status_code != 200:
if status_code != 0:
self.status_code = status_code
self.error = json_response.get('message')

Expand Down

0 comments on commit 082d69f

Please sign in to comment.