Yandex: make api_key a required argument, remove warning
-import warnings
from urllib.parse import urlencode
from geopy.exc import GeocoderParseError, GeocoderServiceError
@@ -24,7 +23,7 @@ class Yandex(Geocoder):
def __init__(
self,
- api_key=None,
+ api_key,
*,
timeout=DEFAULT_SENTINEL,
proxies=DEFAULT_SENTINEL,
@@ -60,14 +59,6 @@ class Yandex(Geocoder):
user_agent=user_agent,
ssl_context=ssl_context,
)
- if not api_key:
- warnings.warn(
- 'Since September 2019 Yandex requires each request to have an API key. '
- 'Pass a valid `api_key` to Yandex geocoder to hide this warning. '
- 'API keys can be created at https://developer.tech.yandex.ru/',
- UserWarning,
- stacklevel=2
- )
self.api_key = api_key
domain = 'geocode-maps.yandex.ru'
self.api = '%s://%s%s' % (self.scheme, domain, self.api_path)
@@ -110,7 +101,6 @@ class Yandex(Geocoder):
'geocode': query,
'format': 'json'
}
- if self.api_key:
params['apikey'] = self.api_key
if lang:
params['lang'] = lang
@@ -173,7 +163,6 @@ class Yandex(Geocoder):
'geocode': point,
'format': 'json'
}
- if self.api_key:
params['apikey'] = self.api_key
if lang:
params['lang'] = lang
