Added the 'rate' result from the Opencage response to the opencage object.
An example response is:
"rate": {
"limit": 2500,
"remaining": 2255,
"reset":
},
An example of how to use it is:
opencage = geocoder.opencage(address, key=OPENCAGE_API_KEY)
print(opencage.rate['remaining'])
It is useful to prevent overrunning the number of allowed API queries per day.
@@ -412,6 +412,9 @@ class OpenCageQuery(MultipleResultsQuery):
def _adapt_results(self, json_response):
# special license attribute
self.license = json_response['licenses']
+ # self.rate['remaining'] returns the number of API queries available on
+ # your API Key
+ self.rate = json_response['rate']
# return geo results
return json_response['results']
