newsdataapi 0.1.25__tar.gz → 0.1.26__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {newsdataapi-0.1.25/newsdataapi.egg-info → newsdataapi-0.1.26}/PKG-INFO +1 -1
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/newsdataapi/constants.py +2 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/newsdataapi/newsdataapi_client.py +17 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26/newsdataapi.egg-info}/PKG-INFO +1 -1
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/setup.py +1 -1
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/tests/test_newsdataapi.py +6 -3
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/LICENSE +0 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/MANIFEST.in +0 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/README.md +0 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/newsdataapi/__init__.py +0 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/newsdataapi/helpers.py +0 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/newsdataapi/newsdataapi_exception.py +0 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/newsdataapi/utils.py +0 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/newsdataapi.egg-info/SOURCES.txt +0 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/newsdataapi.egg-info/dependency_links.txt +0 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/newsdataapi.egg-info/requires.txt +0 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/newsdataapi.egg-info/top_level.txt +0 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/requirements.txt +0 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/setup.cfg +0 -0
- {newsdataapi-0.1.25 → newsdataapi-0.1.26}/tests/__init__.py +0 -0
|
@@ -34,6 +34,7 @@ class NewsDataApiClient(FileHandler):
|
|
|
34
34
|
self.crypto_url = urljoin(new_base_url,constants.CRYPTO_ENDPOINT)
|
|
35
35
|
self.sources_url = urljoin(new_base_url,constants.SOURCES_ENDPOINT)
|
|
36
36
|
self.count_url = urljoin(new_base_url,constants.COUNT_ENDPOINT)
|
|
37
|
+
self.crypto_count_url = urljoin(new_base_url,constants.CRYPTO_COUNT_ENDPOINT)
|
|
37
38
|
|
|
38
39
|
def set_retries( self, max_retries:int, retry_delay:int)->None:
|
|
39
40
|
""" API maximum retry and delay"""
|
|
@@ -323,6 +324,22 @@ class NewsDataApiClient(FileHandler):
|
|
|
323
324
|
URL_parameters = self.__validate_parms(user_param=params)
|
|
324
325
|
URL_parameters_encoded = urlencode(URL_parameters, quote_via=quote)
|
|
325
326
|
return self.__get_feeds(url=f'{self.count_url}?{URL_parameters_encoded}')
|
|
327
|
+
|
|
328
|
+
def crypto_count_api(
|
|
329
|
+
self, q:Optional[str]=None, qInTitle:Optional[str]=None, qInMeta:Optional[str]=None,language:Optional[Union[str, list]]=None,
|
|
330
|
+
from_date:Optional[str]=None,to_date:Optional[str]=None,coin:Optional[str]=None,raw_query:Optional[str]=None
|
|
331
|
+
) -> dict:
|
|
332
|
+
"""
|
|
333
|
+
Sending GET request to the crypto count api
|
|
334
|
+
For more information about parameters and input, Please visit our documentation page: https://newsdata.io/documentation
|
|
335
|
+
"""
|
|
336
|
+
params = {
|
|
337
|
+
'q':q,'qInTitle':qInTitle,'language':language,'from_date':from_date,'to_date':to_date,'coin':coin,
|
|
338
|
+
'apikey':self.apikey,'qInMeta':qInMeta,'raw_query':raw_query
|
|
339
|
+
}
|
|
340
|
+
URL_parameters = self.__validate_parms(user_param=params)
|
|
341
|
+
URL_parameters_encoded = urlencode(URL_parameters, quote_via=quote)
|
|
342
|
+
return self.__get_feeds(url=f'{self.crypto_count_url}?{URL_parameters_encoded}')
|
|
326
343
|
|
|
327
344
|
def __del__(self):
|
|
328
345
|
if isinstance(self.request_method,requests.Session):
|
|
@@ -32,7 +32,10 @@ class test_newsdataapi(unittest.TestCase):
|
|
|
32
32
|
|
|
33
33
|
self.assertEqual(response['status'], "success")
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
def test_count_api(self):
|
|
36
|
+
response = self.api.count_api(language='en')
|
|
37
|
+
self.assertEqual(response['status'], "success")
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
def test_crypto_count_api(self):
|
|
40
|
+
response = self.api.crypto_count_api(q='bitcoin',language='en')
|
|
41
|
+
self.assertEqual(response['status'], "success")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|