newsdataapi 0.1.24__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.
Files changed (20) hide show
  1. {newsdataapi-0.1.24/newsdataapi.egg-info → newsdataapi-0.1.26}/PKG-INFO +1 -1
  2. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/newsdataapi/constants.py +2 -0
  3. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/newsdataapi/newsdataapi_client.py +24 -7
  4. {newsdataapi-0.1.24 → newsdataapi-0.1.26/newsdataapi.egg-info}/PKG-INFO +1 -1
  5. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/setup.py +1 -1
  6. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/tests/test_newsdataapi.py +6 -3
  7. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/LICENSE +0 -0
  8. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/MANIFEST.in +0 -0
  9. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/README.md +0 -0
  10. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/newsdataapi/__init__.py +0 -0
  11. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/newsdataapi/helpers.py +0 -0
  12. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/newsdataapi/newsdataapi_exception.py +0 -0
  13. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/newsdataapi/utils.py +0 -0
  14. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/newsdataapi.egg-info/SOURCES.txt +0 -0
  15. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/newsdataapi.egg-info/dependency_links.txt +0 -0
  16. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/newsdataapi.egg-info/requires.txt +0 -0
  17. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/newsdataapi.egg-info/top_level.txt +0 -0
  18. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/requirements.txt +0 -0
  19. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/setup.cfg +0 -0
  20. {newsdataapi-0.1.24 → newsdataapi-0.1.26}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: newsdataapi
3
- Version: 0.1.24
3
+ Version: 0.1.26
4
4
  Summary: Python library for newsdata client-API Call
5
5
  Home-page: https://github.com/newsdataapi/python-client
6
6
  Author: NewsData.io
@@ -15,6 +15,8 @@ CRYPTO_ENDPOINT = 'crypto'
15
15
 
16
16
  COUNT_ENDPOINT = 'count'
17
17
 
18
+ CRYPTO_COUNT_ENDPOINT = 'crypto/count'
19
+
18
20
  # Default request values
19
21
  DEFAULT_REQUEST_TIMEOUT = 300
20
22
  DEFAULT_MAX_RETRIES = 5
@@ -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"""
@@ -57,7 +58,7 @@ class NewsDataApiClient(FileHandler):
57
58
  string_params = {
58
59
  'q','qInTitle','country','category','language','domain','domainurl','excludedomain','timezone','page',
59
60
  'from_date','to_date','apikey','qInMeta','prioritydomain','timeframe','tag','sentiment','region','coin',
60
- 'excludefield','excludecategory'
61
+ 'excludefield','excludecategory','id'
61
62
  }
62
63
 
63
64
  def validate_url(url:str)-> str:
@@ -228,7 +229,7 @@ class NewsDataApiClient(FileHandler):
228
229
  image:Optional[bool]=None, video:Optional[bool]=None, prioritydomain:Optional[str]=None, page:Optional[str]=None, scroll:Optional[bool]=False,
229
230
  max_result:Optional[int]=None, qInMeta:Optional[str]=None, tag:Optional[Union[str,list]]=None, sentiment:Optional[str]=None,
230
231
  region:Optional[Union[str,list]]=None,excludefield:Optional[Union[str,list]]=None,removeduplicate:Optional[bool]=None,raw_query:Optional[str]=None,
231
- excludecategory:Optional[Union[str,list]]=None
232
+ excludecategory:Optional[Union[str,list]]=None,id:Optional[str]=None
232
233
  )->dict:
233
234
  """
234
235
  Sending GET request to the latest api.
@@ -238,7 +239,7 @@ class NewsDataApiClient(FileHandler):
238
239
  'apikey':self.apikey,'q':q,'qInTitle':qInTitle,'country':country,'category':category,'language':language,'domain':domain,'timeframe':str(timeframe) if timeframe else timeframe,
239
240
  'size':size,'domainurl':domainurl,'excludedomain':excludedomain,'timezone':timezone,'full_content':full_content,'image':image,'video':video,'prioritydomain':prioritydomain,
240
241
  'page':page,'qInMeta':qInMeta,'tag':tag, 'sentiment':sentiment, 'region':region,'excludefield':excludefield,'removeduplicate':removeduplicate,'raw_query':raw_query,
241
- 'excludecategory':excludecategory
242
+ 'excludecategory':excludecategory,'id':id
242
243
  }
243
244
  URL_parameters = self.__validate_parms(user_param=params)
244
245
  URL_parameters_encoded = urlencode(URL_parameters, quote_via=quote)
@@ -253,7 +254,7 @@ class NewsDataApiClient(FileHandler):
253
254
  excludedomain:Optional[Union[str, list]]=None, timezone:Optional[str]=None, full_content:Optional[bool]=None,image:Optional[bool]=None,
254
255
  video:Optional[bool]=None,prioritydomain:Optional[str]=None, page:Optional[str]=None, scroll:Optional[bool]=False, max_result:Optional[int]=None,
255
256
  from_date:Optional[str]=None, to_date:Optional[str]=None, qInMeta:Optional[str]=None, excludefield:Optional[Union[str,list]]=None,raw_query:Optional[str]=None,
256
- excludecategory:Optional[Union[str,list]]=None
257
+ excludecategory:Optional[Union[str,list]]=None,id:Optional[str]=None
257
258
  ) -> dict:
258
259
  """
259
260
  Sending GET request to the archive api
@@ -262,7 +263,7 @@ class NewsDataApiClient(FileHandler):
262
263
  params = {
263
264
  'q':q,'qInTitle':qInTitle,'country':country,'category':category,'language':language,'domain':domain,'size':size,'domainurl':domainurl,'excludedomain':excludedomain,
264
265
  'timezone':timezone,'full_content':full_content,'image':image,'video':video,'prioritydomain':prioritydomain,'page':page,'from_date':from_date,'to_date':to_date,
265
- 'apikey':self.apikey,'qInMeta':qInMeta,'excludefield':excludefield,'raw_query':raw_query,'excludecategory':excludecategory
266
+ 'apikey':self.apikey,'qInMeta':qInMeta,'excludefield':excludefield,'raw_query':raw_query,'excludecategory':excludecategory,'id':id
266
267
  }
267
268
  URL_parameters = self.__validate_parms(user_param=params)
268
269
  URL_parameters_encoded = urlencode(URL_parameters, quote_via=quote)
@@ -287,7 +288,7 @@ class NewsDataApiClient(FileHandler):
287
288
  timezone:Optional[str]=None, full_content:Optional[bool]=None,image:Optional[bool]=None, video:Optional[bool]=None, prioritydomain:Optional[str]=None,
288
289
  page:Optional[str]=None, scroll:Optional[bool]=False,max_result:Optional[int]=None, qInMeta:Optional[str]=None,tag:Optional[Union[str,list]]=None,
289
290
  sentiment:Optional[str]=None,coin:Optional[Union[str, list]]=None,excludefield:Optional[Union[str,list]]=None,from_date:Optional[str]=None,
290
- to_date:Optional[str]=None,removeduplicate:Optional[bool]=None,raw_query:Optional[str]=None,
291
+ to_date:Optional[str]=None,removeduplicate:Optional[bool]=None,raw_query:Optional[str]=None,id:Optional[str]=None,
291
292
  )->dict:
292
293
  """
293
294
  Sending GET request to the crypto api
@@ -298,7 +299,7 @@ class NewsDataApiClient(FileHandler):
298
299
  'apikey':self.apikey,'q':q,'qInTitle':qInTitle,'language':language,'domain':domain,'size':size,'domainurl':domainurl,
299
300
  'excludedomain':excludedomain,'timezone':timezone,'full_content':full_content,'image':image,'video':video,'prioritydomain':prioritydomain,'page':page,
300
301
  'timeframe':str(timeframe) if timeframe else timeframe,'qInMeta':qInMeta,'tag':tag, 'sentiment':sentiment,'coin':coin,'excludefield':excludefield,
301
- 'from_date':from_date,'to_date':to_date,'removeduplicate':removeduplicate,'raw_query':raw_query
302
+ 'from_date':from_date,'to_date':to_date,'removeduplicate':removeduplicate,'raw_query':raw_query,'id':id
302
303
  }
303
304
  URL_parameters = self.__validate_parms(user_param=params)
304
305
  URL_parameters_encoded = urlencode(URL_parameters, quote_via=quote)
@@ -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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: newsdataapi
3
- Version: 0.1.24
3
+ Version: 0.1.26
4
4
  Summary: Python library for newsdata client-API Call
5
5
  Home-page: https://github.com/newsdataapi/python-client
6
6
  Author: NewsData.io
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
6
6
 
7
7
  setup(
8
8
  name='newsdataapi',
9
- version='0.1.24',
9
+ version='0.1.26',
10
10
  packages=['newsdataapi'],
11
11
  description='Python library for newsdata client-API Call',
12
12
  long_description=long_description,
@@ -32,7 +32,10 @@ class test_newsdataapi(unittest.TestCase):
32
32
 
33
33
  self.assertEqual(response['status'], "success")
34
34
 
35
- # def test_count_api(self):
36
- # response = self.api.count_api(language='en')
35
+ def test_count_api(self):
36
+ response = self.api.count_api(language='en')
37
+ self.assertEqual(response['status'], "success")
37
38
 
38
- # self.assertEqual(response['status'], "success")
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