Пример #1
0
 def __init__(self,
              api_key: str,
              api_url='https://newsapi.org/v2/',
              timeout=30,
              countries=COUNTRIES,
              categories=CATEGORIES,
              languages=LANGUAGES) -> None:
     self._url = api_url.rstrip('/')
     self._get = partial(requests.get,
                         auth=NewsApiAuth(api_key=api_key),
                         timeout=timeout)
     self._COUNTRIES = countries
     self._CATEGORIES = categories
     self._LANGUAGES = languages
 def __init__(self, api_key, api_url='https://newsapi.org/v2/'):
     self.url = api_url.rstrip('/')
     self.auth = NewsApiAuth(api_key=api_key)
Пример #3
0
 def __init__(self, api_key):
     self.auth = NewsApiAuth(api_key=api_key)
Пример #4
0
 def __init__(self, api_key):
     self.auth = NewsApiAuth(api_key='e4313a22f54042c9aba095ce5354be51')
Пример #5
0
 def __init__(self, api_key, session=None):
     self.auth = NewsApiAuth(api_key=api_key)
     if session is None:
         self.request_method = requests
     else:
         self.request_method = session