@@ -95,11 +95,9 @@ def __init__(self, message, bad_value=None):
9595 self .message = message
9696 self .bad_value = bad_value
9797
98- def __unicode__ (self ):
98+ def __str__ (self ):
9999 return self .message
100100
101- __str__ = __unicode__
102-
103101
104102class UnknownError (OpenCageGeocodeError ):
105103 """There was a problem with the OpenCage server."""
@@ -108,33 +106,27 @@ class UnknownError(OpenCageGeocodeError):
108106class RateLimitExceededError (OpenCageGeocodeError ):
109107 """Exception raised when account has exceeded its limit."""
110108
111- def __unicode__ (self ):
109+ def __str__ (self ):
112110 """Convert exception to a string."""
113111 return ("You have used the requests available on your plan. "
114112 "Please purchase more if you wish to continue: https://opencagedata.com/pricing" )
115113
116- __str__ = __unicode__
117-
118114
119115class NotAuthorizedError (OpenCageGeocodeError ):
120116 """Exception raised when an unauthorized API key is used."""
121117
122- def __unicode__ (self ):
118+ def __str__ (self ):
123119 """Convert exception to a string."""
124120 return "Your API key is not authorized. You may have entered it incorrectly."
125121
126- __str__ = __unicode__
127-
128122
129123class ForbiddenError (OpenCageGeocodeError ):
130124 """Exception raised when a blocked or suspended API key is used."""
131125
132- def __unicode__ (self ):
126+ def __str__ (self ):
133127 """Convert exception to a string."""
134128 return "Your API key has been blocked or suspended."
135129
136- __str__ = __unicode__
137-
138130
139131class AioHttpError (OpenCageGeocodeError ):
140132 """Exception raised for errors related to async HTTP calls with aiohttp."""
@@ -143,14 +135,12 @@ class AioHttpError(OpenCageGeocodeError):
143135class SSLError (OpenCageGeocodeError ):
144136 """Exception raised when SSL connection to OpenCage server fails."""
145137
146- def __unicode__ (self ):
138+ def __str__ (self ):
147139 """Convert exception to a string."""
148140 return ("SSL Certificate error connecting to OpenCage API. This is usually due to "
149141 "outdated CA root certificates of the operating system. "
150142 )
151143
152- __str__ = __unicode__
153-
154144
155145class NetworkError (OpenCageGeocodeError ):
156146 """Exception raised when the connection to the OpenCage API fails."""
@@ -620,7 +610,7 @@ def floatify_latlng(input_value):
620610 # This dict has only 2 keys 'lat' & 'lon'
621611 return {'lat' : float_if_float (input_value ["lat" ]), 'lng' : float_if_float (input_value ["lng" ])}
622612
623- return dict (( key , floatify_latlng (value )) for key , value in input_value .items ())
613+ return { key : floatify_latlng (value ) for key , value in input_value .items ()}
624614
625615 if isinstance (input_value , collections .abc .MutableSequence ):
626616 return [floatify_latlng (x ) for x in input_value ]
0 commit comments