If the user has a wrong base64 padded secret key the googlemaps python library is returning "TypeError: Incorrect padding" which is very hard to understand. So now we check if the secret key is a valid base64 string
24 lines
538 B
Python
24 lines
538 B
Python
#!/usr/local/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
import json
|
|
|
|
class InvalidGoogleCredentials(Exception):
|
|
pass
|
|
|
|
class BadGeocodingParams(Exception):
|
|
def __init__(self, value):
|
|
self.value = value
|
|
|
|
def __str__(self):
|
|
return repr('Bad geocoding params: ' + json.dumps(self.value))
|
|
|
|
|
|
class NoGeocodingParams(Exception):
|
|
def __str__(self):
|
|
return repr('No params for geocoding specified')
|
|
|
|
|
|
class MalformedResult(Exception):
|
|
def __str__(self):
|
|
return repr('Result structure is malformed')
|